Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions pkgs/development/python-modules/aetcd/default.nix
Original file line number Diff line number Diff line change
@@ -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 ];
};
}
75 changes: 54 additions & 21 deletions pkgs/development/python-modules/limits/default.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{ lib
, aetcd
, buildPythonPackage
, coredis
, deprecated
, fetchFromGitHub
, etcd3
, fetchFromGitHub
, hiro
, importlib-resources
, motor
, packaging
, pymemcache
, pymongo
Expand All @@ -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
Expand All @@ -37,36 +40,65 @@ buildPythonPackage rec {
hash = "sha256-0h3ofungHkjycUvNJ3jf+VB/GSrshgUDECN2YoPGzzg=";
};

postPatch = ''
substituteInPlace pytest.ini \
--replace-fail "--cov=limits" "" \
--replace-fail "-K" ""

substituteInPlace setup.py \
--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
setuptools
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 = [
etcd3
hiro
pymemcache
pymongo
pytest-asyncio
pytest-lazy-fixture
pytestCheckHook
redis
];

postPatch = ''
substituteInPlace pytest.ini \
--replace "--cov=limits" "" \
--replace "-K" ""

substituteInPlace setup.py \
--replace "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
'';
] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);

pythonImportsCheck = [
"limits"
Expand All @@ -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; [ ];
};
Expand Down
19 changes: 4 additions & 15 deletions pkgs/development/python-modules/slowapi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
2 changes: 2 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 { };
Expand Down