2022-05-18 14:49:53 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, deprecated
|
|
|
|
, fetchFromGitHub
|
2023-03-15 16:39:30 +00:00
|
|
|
, etcd3
|
2022-05-18 14:49:53 +00:00
|
|
|
, hiro
|
2023-07-15 17:15:38 +00:00
|
|
|
, importlib-resources
|
2022-05-18 14:49:53 +00:00
|
|
|
, 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";
|
2024-01-13 08:15:51 +00:00
|
|
|
version = "3.7.0";
|
2022-05-18 14:49:53 +00:00
|
|
|
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;
|
2023-01-20 10:41:00 +00:00
|
|
|
rev = "refs/tags/${version}";
|
2022-05-18 14:49:53 +00:00
|
|
|
# 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.
|
2022-06-16 17:23:12 +00:00
|
|
|
postFetch = ''
|
2022-05-18 14:49:53 +00:00
|
|
|
rm "$out/limits/_version.py"
|
|
|
|
'';
|
2024-01-13 08:15:51 +00:00
|
|
|
hash = "sha256-0h3ofungHkjycUvNJ3jf+VB/GSrshgUDECN2YoPGzzg=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
deprecated
|
2023-07-15 17:15:38 +00:00
|
|
|
importlib-resources
|
2022-05-18 14:49:53 +00:00
|
|
|
packaging
|
|
|
|
setuptools
|
|
|
|
typing-extensions
|
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2023-03-15 16:39:30 +00:00
|
|
|
etcd3
|
2022-05-18 14:49:53 +00:00
|
|
|
hiro
|
|
|
|
pymemcache
|
|
|
|
pymongo
|
|
|
|
pytest-asyncio
|
|
|
|
pytest-lazy-fixture
|
|
|
|
pytestCheckHook
|
|
|
|
redis
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace pytest.ini \
|
|
|
|
--replace "--cov=limits" "" \
|
|
|
|
--replace "-K" ""
|
|
|
|
|
2022-09-14 18:05:37 +00:00
|
|
|
substituteInPlace setup.py \
|
|
|
|
--replace "versioneer.get_version()" "'${version}'"
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
# 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; {
|
2022-09-14 18:05:37 +00:00
|
|
|
description = "Rate limiting using various strategies and storage backends such as redis & memcached";
|
|
|
|
homepage = "https://github.com/alisaifee/limits";
|
2022-05-18 14:49:53 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|