From 282d32e76a4c2538cbedf332ce99fcac82b2b647 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sun, 11 Feb 2024 09:10:16 +0100 Subject: [PATCH 1/4] python311Packages.slowapi: 0.1.8 -> 0.1.9 Diff: https://github.com/laurentS/slowapi/compare/refs/tags/v0.1.8...v0.1.9 Changelog: https://github.com/laurentS/slowapi/blob/v0.1.9/CHANGELOG.md --- pkgs/development/python-modules/slowapi/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/slowapi/default.nix b/pkgs/development/python-modules/slowapi/default.nix index 089d4d2743e9..a188f6b9c7bd 100644 --- a/pkgs/development/python-modules/slowapi/default.nix +++ b/pkgs/development/python-modules/slowapi/default.nix @@ -17,7 +17,7 @@ buildPythonPackage rec { pname = "slowapi"; - version = "0.1.8"; + version = "0.1.9"; format = "pyproject"; disabled = pythonOlder "3.7"; @@ -26,7 +26,7 @@ buildPythonPackage rec { owner = "laurentS"; repo = pname; rev = "refs/tags/v${version}"; - hash = "sha256-xgHz8b95SXf/GwzKPfQ/RHbUNJfCx6+7a2HB8+6hjsw="; + hash = "sha256-R/Mr+Qv22AN7HCDGmAUVh4efU8z4gMIyhC0AuKmxgdE="; }; pythonRelaxDeps = [ From 7fd329110c82868520c1a9736317bec5ddf40b7e Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sun, 11 Feb 2024 09:22:50 +0100 Subject: [PATCH 2/4] python311Packages.slowapi: refactor --- .../python-modules/slowapi/default.nix | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/pkgs/development/python-modules/slowapi/default.nix b/pkgs/development/python-modules/slowapi/default.nix index a188f6b9c7bd..c64a89d896df 100644 --- a/pkgs/development/python-modules/slowapi/default.nix +++ b/pkgs/development/python-modules/slowapi/default.nix @@ -10,7 +10,6 @@ , pytestCheckHook , pythonAtLeast , pythonOlder -, pythonRelaxDepsHook , redis , starlette }: @@ -18,29 +17,19 @@ buildPythonPackage rec { pname = "slowapi"; version = "0.1.9"; - format = "pyproject"; + pyproject = true; disabled = pythonOlder "3.7"; src = fetchFromGitHub { owner = "laurentS"; - repo = pname; + repo = "slowapi"; rev = "refs/tags/v${version}"; hash = "sha256-R/Mr+Qv22AN7HCDGmAUVh4efU8z4gMIyhC0AuKmxgdE="; }; - pythonRelaxDeps = [ - "limits" - ]; - - postPatch = '' - substituteInPlace pyproject.toml \ - --replace '["redis^3.4.1"]' '["redis"]' - ''; - nativeBuildInputs = [ poetry-core - pythonRelaxDepsHook ]; propagatedBuildInputs = [ From 8a7fcdca70d7c94f40ae4b72612bdb54cba74d16 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sun, 11 Feb 2024 10:14:49 +0100 Subject: [PATCH 3/4] python311Packages.aetcd: init at 1.0.0a4 Python asyncio-based client for etcd https://github.com/martyanov/aetcd --- .../python-modules/aetcd/default.nix | 67 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 69 insertions(+) create mode 100644 pkgs/development/python-modules/aetcd/default.nix 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/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 809e3986fa57..a3a0f27d3c85 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 { }; From 4f94d3a625a20746b12a482cd6a5198c9c208886 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 12 Feb 2024 08:15:34 +0100 Subject: [PATCH 4/4] python311Packages.limits: add optional-dependencies --- .../python-modules/limits/default.nix | 83 +++++++++++++------ 1 file changed, 58 insertions(+), 25 deletions(-) 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; [ ]; };