2022-05-18 14:49:53 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, deprecated
|
|
|
|
, fetchFromGitHub
|
|
|
|
, hiro
|
|
|
|
, packaging
|
|
|
|
, pymemcache
|
|
|
|
, pymongo
|
|
|
|
, pytest-asyncio
|
|
|
|
, pytest-lazy-fixture
|
|
|
|
, pytestCheckHook
|
|
|
|
, pythonOlder
|
|
|
|
, redis
|
|
|
|
, setuptools
|
|
|
|
, typing-extensions
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "limits";
|
2022-05-18 14:49:53 +00:00
|
|
|
version = "2.6.1";
|
|
|
|
format = "setuptools";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "alisaifee";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
|
|
|
# Upstream uses versioneer, which relies on git attributes substitution.
|
|
|
|
# This leads to non-reproducible archives on github. Remove the substituted
|
|
|
|
# file here, and recreate it later based on our version info.
|
|
|
|
extraPostFetch = ''
|
|
|
|
rm "$out/limits/_version.py"
|
|
|
|
'';
|
|
|
|
hash = "sha256-ja+YbRHCcZ5tFnoofdR44jbkkdDroVUdKeDOt6yE0LI=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
deprecated
|
|
|
|
packaging
|
|
|
|
setuptools
|
|
|
|
typing-extensions
|
|
|
|
];
|
|
|
|
|
|
|
|
checkInputs = [
|
|
|
|
hiro
|
|
|
|
pymemcache
|
|
|
|
pymongo
|
|
|
|
pytest-asyncio
|
|
|
|
pytest-lazy-fixture
|
|
|
|
pytestCheckHook
|
|
|
|
redis
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace pytest.ini \
|
|
|
|
--replace "--cov=limits" "" \
|
|
|
|
--replace "-K" ""
|
|
|
|
# redis-py-cluster doesn't support redis > 4
|
|
|
|
substituteInPlace tests/conftest.py \
|
|
|
|
--replace "import rediscluster" ""
|
|
|
|
|
|
|
|
# Recreate _version.py, deleted at fetch time due to non-reproducibility.
|
|
|
|
echo 'def get_versions(): return {"version": "${version}"}' > limits/_version.py
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"limits"
|
|
|
|
];
|
|
|
|
|
|
|
|
pytestFlagsArray = [
|
|
|
|
# All other tests require a running Docker instance
|
|
|
|
"tests/test_limits.py"
|
|
|
|
"tests/test_ratelimit_parser.py"
|
|
|
|
"tests/test_limit_granularities.py"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Rate limiting utilities";
|
|
|
|
homepage = "https://limits.readthedocs.org/";
|
2022-05-18 14:49:53 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|