at 23.11-beta 2.0 kB view raw
1{ lib 2, buildPythonPackage 3, deprecated 4, fetchFromGitHub 5, etcd3 6, hiro 7, importlib-resources 8, packaging 9, pymemcache 10, pymongo 11, pytest-asyncio 12, pytest-lazy-fixture 13, pytestCheckHook 14, pythonOlder 15, redis 16, setuptools 17, typing-extensions 18}: 19 20buildPythonPackage rec { 21 pname = "limits"; 22 version = "3.6.0"; 23 format = "setuptools"; 24 25 disabled = pythonOlder "3.7"; 26 27 src = fetchFromGitHub { 28 owner = "alisaifee"; 29 repo = pname; 30 rev = "refs/tags/${version}"; 31 # Upstream uses versioneer, which relies on git attributes substitution. 32 # This leads to non-reproducible archives on github. Remove the substituted 33 # file here, and recreate it later based on our version info. 34 postFetch = '' 35 rm "$out/limits/_version.py" 36 ''; 37 hash = "sha256-VLfFWFcwLgEEvPUKQ00QjEq1HN28OpE6Eu1eyF+TwXU="; 38 }; 39 40 propagatedBuildInputs = [ 41 deprecated 42 importlib-resources 43 packaging 44 setuptools 45 typing-extensions 46 ]; 47 48 nativeCheckInputs = [ 49 etcd3 50 hiro 51 pymemcache 52 pymongo 53 pytest-asyncio 54 pytest-lazy-fixture 55 pytestCheckHook 56 redis 57 ]; 58 59 postPatch = '' 60 substituteInPlace pytest.ini \ 61 --replace "--cov=limits" "" \ 62 --replace "-K" "" 63 64 substituteInPlace setup.py \ 65 --replace "versioneer.get_version()" "'${version}'" 66 67 # Recreate _version.py, deleted at fetch time due to non-reproducibility. 68 echo 'def get_versions(): return {"version": "${version}"}' > limits/_version.py 69 ''; 70 71 pythonImportsCheck = [ 72 "limits" 73 ]; 74 75 pytestFlagsArray = [ 76 # All other tests require a running Docker instance 77 "tests/test_limits.py" 78 "tests/test_ratelimit_parser.py" 79 "tests/test_limit_granularities.py" 80 ]; 81 82 meta = with lib; { 83 description = "Rate limiting using various strategies and storage backends such as redis & memcached"; 84 homepage = "https://github.com/alisaifee/limits"; 85 license = licenses.mit; 86 maintainers = with maintainers; [ ]; 87 }; 88}