diff --git a/pkgs/development/python-modules/aetcd/default.nix b/pkgs/development/python-modules/aetcd/default.nix new file mode 100644 index 000000000000..8a2652450cd1 --- /dev/null +++ b/pkgs/development/python-modules/aetcd/default.nix @@ -0,0 +1,67 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, grpcio +, protobuf +, pytest-asyncio +, pytest-mock +, pytestCheckHook +, pythonOlder +, setuptools +, setuptools-scm +}: + +buildPythonPackage rec { + pname = "aetcd"; + version = "1.0.0a4"; + pyproject = true; + + disabled = pythonOlder "3.8"; + + src = fetchFromGitHub { + owner = "martyanov"; + repo = "aetcd"; + rev = "refs/tags/v${version}"; + hash = "sha256-g49ppfh8dyGpZeu/HdTDX8RAk5VTcZmqENRpNY12qkg="; + }; + + postPatch = '' + substituteInPlace setup.py \ + --replace-fail "setuptools_scm==6.3.2" "setuptools_scm" + substituteInPlace setup.cfg \ + --replace-fail "--cov=aetcd" "" + ''; + + nativeBuildInputs = [ + setuptools + setuptools-scm + ]; + + propagatedBuildInputs = [ + grpcio + protobuf + ]; + + nativeCheckInputs = [ + pytest-asyncio + pytest-mock + pytestCheckHook + ]; + + pythonImportsCheck = [ + "aetcd" + ]; + + disabledTestPaths = [ + # Tests require a running ectd instance + "tests/integration/" + ]; + + meta = with lib; { + description = "Python asyncio-based client for etcd"; + homepage = "https://github.com/martyanov/aetcd"; + changelog = "https://github.com/martyanov/aetcd/blob/v${version}/docs/changelog.rst"; + license = licenses.asl20; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/development/python-modules/limits/default.nix b/pkgs/development/python-modules/limits/default.nix index f55fd087cad9..e0c1fcf9a14c 100644 --- a/pkgs/development/python-modules/limits/default.nix +++ b/pkgs/development/python-modules/limits/default.nix @@ -1,10 +1,13 @@ { lib +, aetcd , buildPythonPackage +, coredis , deprecated -, fetchFromGitHub , etcd3 +, fetchFromGitHub , hiro , importlib-resources +, motor , packaging , pymemcache , pymongo @@ -20,13 +23,13 @@ buildPythonPackage rec { pname = "limits"; version = "3.7.0"; - format = "setuptools"; + pyproject = true; disabled = pythonOlder "3.7"; src = fetchFromGitHub { owner = "alisaifee"; - repo = pname; + repo = "limits"; rev = "refs/tags/${version}"; # Upstream uses versioneer, which relies on git attributes substitution. # This leads to non-reproducible archives on github. Remove the substituted @@ -37,37 +40,66 @@ buildPythonPackage rec { hash = "sha256-0h3ofungHkjycUvNJ3jf+VB/GSrshgUDECN2YoPGzzg="; }; - propagatedBuildInputs = [ - deprecated - importlib-resources - packaging - setuptools - typing-extensions - ]; - - nativeCheckInputs = [ - etcd3 - hiro - pymemcache - pymongo - pytest-asyncio - pytest-lazy-fixture - pytestCheckHook - redis - ]; - postPatch = '' substituteInPlace pytest.ini \ - --replace "--cov=limits" "" \ - --replace "-K" "" + --replace-fail "--cov=limits" "" \ + --replace-fail "-K" "" substituteInPlace setup.py \ - --replace "versioneer.get_version()" "'${version}'" + --replace-fail "versioneer.get_version()" "'${version}'" # Recreate _version.py, deleted at fetch time due to non-reproducibility. echo 'def get_versions(): return {"version": "${version}"}' > limits/_version.py ''; + nativeBuildInputs = [ + setuptools + ]; + + propagatedBuildInputs = [ + deprecated + importlib-resources + packaging + typing-extensions + ]; + + passthru.optional-dependencies = { + redis = [ + redis + ]; + rediscluster = [ + redis + ]; + memcached = [ + pymemcache + ]; + mongodb = [ + pymongo + ]; + etcd = [ + etcd3 + ]; + async-redis = [ + coredis + ]; + # async-memcached = [ + # emcache # Missing module + # ]; + async-mongodb = [ + motor + ]; + async-etcd = [ + aetcd + ]; + }; + + nativeCheckInputs = [ + hiro + pytest-asyncio + pytest-lazy-fixture + pytestCheckHook + ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies); + pythonImportsCheck = [ "limits" ]; @@ -82,6 +114,7 @@ buildPythonPackage rec { meta = with lib; { description = "Rate limiting using various strategies and storage backends such as redis & memcached"; homepage = "https://github.com/alisaifee/limits"; + changelog = "https://github.com/alisaifee/limits/releases/tag/${version}"; license = licenses.mit; maintainers = with maintainers; [ ]; }; diff --git a/pkgs/development/python-modules/slowapi/default.nix b/pkgs/development/python-modules/slowapi/default.nix index 089d4d2743e9..c64a89d896df 100644 --- a/pkgs/development/python-modules/slowapi/default.nix +++ b/pkgs/development/python-modules/slowapi/default.nix @@ -10,37 +10,26 @@ , pytestCheckHook , pythonAtLeast , pythonOlder -, pythonRelaxDepsHook , redis , starlette }: buildPythonPackage rec { pname = "slowapi"; - version = "0.1.8"; - format = "pyproject"; + version = "0.1.9"; + pyproject = true; disabled = pythonOlder "3.7"; src = fetchFromGitHub { owner = "laurentS"; - repo = pname; + repo = "slowapi"; rev = "refs/tags/v${version}"; - hash = "sha256-xgHz8b95SXf/GwzKPfQ/RHbUNJfCx6+7a2HB8+6hjsw="; + hash = "sha256-R/Mr+Qv22AN7HCDGmAUVh4efU8z4gMIyhC0AuKmxgdE="; }; - pythonRelaxDeps = [ - "limits" - ]; - - postPatch = '' - substituteInPlace pyproject.toml \ - --replace '["redis^3.4.1"]' '["redis"]' - ''; - nativeBuildInputs = [ poetry-core - pythonRelaxDepsHook ]; propagatedBuildInputs = [ diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 9c483e790da8..71d7fc931e7b 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -105,6 +105,8 @@ self: super: with self; { aesedb = callPackage ../development/python-modules/aesedb { }; + aetcd = callPackage ../development/python-modules/aetcd { }; + afdko = callPackage ../development/python-modules/afdko { }; affine = callPackage ../development/python-modules/affine { };