1
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-03 22:32:26 +03:00
nixpkgs/pkgs/development/python-modules/limits/default.nix

85 lines
1.9 KiB
Nix
Raw Normal View History

2022-02-16 10:06:32 +01:00
{ lib
, buildPythonPackage
, deprecated
2022-02-16 10:06:32 +01:00
, fetchFromGitHub
, hiro
, packaging
2022-02-16 10:06:32 +01:00
, pymemcache
, pymongo
, pytest-asyncio
, pytest-lazy-fixture
, pytestCheckHook
, pythonOlder
, redis
, setuptools
, typing-extensions
2022-02-16 10:06:32 +01:00
}:
2018-01-20 11:49:34 +01:00
buildPythonPackage rec {
pname = "limits";
2022-12-30 20:13:23 +01:00
version = "2.8.0";
2022-02-16 10:06:32 +01:00
format = "setuptools";
2018-01-20 11:49:34 +01:00
2022-02-16 10:06:32 +01:00
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "alisaifee";
repo = pname;
2022-12-30 20:13:23 +01:00
rev = "refs/tags/${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.
2022-05-17 22:10:33 +03:00
postFetch = ''
rm "$out/limits/_version.py"
'';
2022-12-30 20:13:23 +01:00
hash = "sha256-XGYwSe9KWw6PdxDjyqZ5kw5jlBxQR0VYacquwZ2z8rA=";
2018-01-20 11:49:34 +01:00
};
2022-02-16 10:06:32 +01:00
propagatedBuildInputs = [
deprecated
packaging
2022-02-16 10:06:32 +01:00
setuptools
typing-extensions
2022-02-16 10:06:32 +01:00
];
checkInputs = [
hiro
pymemcache
pymongo
2022-02-16 10:06:32 +01:00
pytest-asyncio
pytest-lazy-fixture
pytestCheckHook
redis
2022-02-16 10:06:32 +01:00
];
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
2022-02-16 10:06:32 +01:00
'';
2018-01-20 11:49:34 +01:00
2022-02-16 10:06:32 +01: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"
];
2018-01-20 11:49:34 +01:00
meta = with lib; {
2022-08-26 09:15:01 +02:00
description = "Rate limiting using various strategies and storage backends such as redis & memcached";
homepage = "https://github.com/alisaifee/limits";
2022-02-16 10:06:32 +01:00
license = licenses.mit;
maintainers = with maintainers; [ ];
2018-01-20 11:49:34 +01:00
};
}