Merge pull request #254252 from pbsds/cachier-init

python3Packages.cachier: init at 2.2.1
This commit is contained in:
Robert Schütz 2023-09-14 00:34:21 +00:00 committed by GitHub
commit 8cbf615833
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 156 additions and 0 deletions

View File

@ -0,0 +1,87 @@
{ lib
, buildPythonPackage
, pythonOlder
, fetchPypi
, pythonRelaxDepsHook
, setuptools
, watchdog
, portalocker
, pathtools
, pytestCheckHook
, pymongo
, dnspython
, pymongo-inmemory
, pandas
}:
buildPythonPackage rec {
pname = "cachier";
version = "2.2.1";
format = "setuptools";
disabled = pythonOlder "3.8";
src = fetchPypi {
inherit pname version;
hash = "sha256-nm98LT87Z7yErKvIqMp93OEX9TDojqqtItgryHgSQJQ=";
};
pythonRemoveDeps = [ "setuptools" ];
nativeBuildInputs = [
pythonRelaxDepsHook
setuptools
];
propagatedBuildInputs = [
watchdog
portalocker
pathtools
];
preCheck = ''
substituteInPlace pytest.ini \
--replace \
"--cov" \
"#--cov"
'';
nativeCheckInputs = [
pytestCheckHook
pymongo
dnspython
pymongo-inmemory
pandas
];
disabledTests = [
# touches network
"test_mongetter_default_param"
"test_stale_after_applies_dynamically"
"test_next_time_applies_dynamically"
"test_wait_for_calc_"
"test_precache_value"
"test_ignore_self_in_methods"
"test_mongo_index_creation"
"test_mongo_core"
# don't test formatting
"test_flake8"
];
preBuild = ''
export HOME="$(mktemp -d)"
'';
pythonImportsCheck = [
"cachier"
"cachier.scripts"
];
meta = {
homepage = "https://github.com/python-cachier/cachier";
description = "Persistent, stale-free, local and cross-machine caching for functions";
maintainers = with lib.maintainers; [ pbsds ];
license = lib.licenses.mit;
};
}

View File

@ -0,0 +1,65 @@
{ lib
, buildPythonPackage
, pythonOlder
, fetchFromGitHub
, fetchpatch
, poetry-core
, pymongo
, pytestCheckHook
}:
buildPythonPackage rec {
pname = "pymongo-inmemory";
version = "0.3.1";
format = "pyproject";
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "kaizendorks";
repo = "pymongo_inmemory";
rev = "refs/tags/v${version}";
hash = "sha256-1v36cI6JjDZA/uJE85NSMNnoyKI1VCgDrymfnCkpVqU=";
};
postPatch = ''
# move cache location from nix store to home
substituteInPlace pymongo_inmemory/context.py \
--replace \
'CACHE_FOLDER = path.join(path.dirname(__file__), "..", ".cache")' \
'CACHE_FOLDER = os.environ.get("XDG_CACHE_HOME", os.environ["HOME"] + "/.cache") + "/pymongo-inmemory"'
# fix a broken assumption arising from the above fix
substituteInPlace pymongo_inmemory/_utils.py \
--replace \
'os.mkdir(current_path)' \
'os.makedirs(current_path)'
'';
nativeBuildInputs = [
poetry-core
];
propagatedBuildInputs = [
pymongo
];
nativeCheckInputs = [
pytestCheckHook
];
preCheck = ''
export HOME="$(mktemp -d)"
'';
pythonImportsCheck = [
"pymongo_inmemory"
];
meta = {
homepage = "https://github.com/kaizendorks/pymongo_inmemory";
description = "A mongo mocking library with an ephemeral MongoDB running in memory";
maintainers = with lib.maintainers; [ pbsds ];
license = lib.licenses.mit;
};
}

View File

@ -1695,6 +1695,8 @@ self: super: with self; {
cacheyou = callPackage ../development/python-modules/cacheyou { };
cachier = callPackage ../development/python-modules/cachier { };
cachy = callPackage ../development/python-modules/cachy { };
cadquery = callPackage ../development/python-modules/cadquery {
@ -9532,6 +9534,8 @@ self: super: with self; {
pymongo = callPackage ../development/python-modules/pymongo { };
pymongo-inmemory = callPackage ../development/python-modules/pymongo-inmemory { };
pymoo = callPackage ../development/python-modules/pymoo { };
pymorphy2 = callPackage ../development/python-modules/pymorphy2 { };