depot/third_party/nixpkgs/pkgs/development/python-modules/limits/default.nix
Default email 02cf88bb76 Project import generated by Copybara.
GitOrigin-RevId: c4a0efdd5a728e20791b8d8d2f26f90ac228ee8d
2022-08-12 15:06:08 +03:00

81 lines
1.7 KiB
Nix

{ lib
, buildPythonPackage
, deprecated
, fetchFromGitHub
, hiro
, packaging
, pymemcache
, pymongo
, pytest-asyncio
, pytest-lazy-fixture
, pytestCheckHook
, pythonOlder
, redis
, setuptools
, typing-extensions
}:
buildPythonPackage rec {
pname = "limits";
version = "2.7.0";
format = "setuptools";
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.
postFetch = ''
rm "$out/limits/_version.py"
'';
hash = "sha256-TBZElCogPtoR2qX1YjBgpYh99LhrvLHFtr2ogemo9/c=";
};
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" ""
# Recreate _version.py, deleted at fetch time due to non-reproducibility.
echo 'def get_versions(): return {"version": "${version}"}' > limits/_version.py
'';
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"
];
meta = with lib; {
description = "Rate limiting utilities";
homepage = "https://limits.readthedocs.org/";
license = licenses.mit;
maintainers = with maintainers; [ ];
};
}