1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 fetchpatch2, 6 dill, 7 mock, 8 pytestCheckHook, 9 setuptools, 10}: 11 12buildPythonPackage rec { 13 pname = "expiringdict"; 14 version = "1.2.2"; 15 pyproject = true; 16 17 # use fetchFromGitHub instead of fetchPypi because the test suite of 18 # the package is not included into the PyPI tarball 19 src = fetchFromGitHub { 20 owner = "mailgun"; 21 repo = "expiringdict"; 22 tag = "v${version}"; 23 hash = "sha256-vRhJSHIqc51I+s/wndtfANM44CKW3QS1iajqyoSBf0I="; 24 }; 25 26 patches = [ 27 # apply mailgun/expiringdict#49 to address NixOS/nixpkgs#326513 28 (fetchpatch2 { 29 url = "https://github.com/mailgun/expiringdict/commit/1c0f82232d20f8b3b31c9269a4d0e9510c1721a6.patch"; 30 hash = "sha256-IeeJVb2tOwRhEPNGqM30fNZyz3jFcnZNWC3I6K1+hSY="; 31 }) 32 33 # apply mailgun/expiringdict#56 for compatibility with Python 3.12 34 (fetchpatch2 { 35 url = "https://github.com/mailgun/expiringdict/commit/976faf3664d54049e443aca054f5819db834577b.patch"; 36 hash = "sha256-FNdnU6iUMyED5j8oAjhmJTR7zQeEc/Z5s64pdeT4F8w="; 37 }) 38 ]; 39 40 build-system = [ setuptools ]; 41 42 nativeCheckInputs = [ 43 dill 44 mock 45 pytestCheckHook 46 ]; 47 48 pythonImportsCheck = [ "expiringdict" ]; 49 50 meta = with lib; { 51 changelog = "https://github.com/mailgun/expiringdict/blob/${src.rev}/CHANGELOG.rst"; 52 description = "Dictionary with auto-expiring values for caching purposes"; 53 homepage = "https://github.com/mailgun/expiringdict"; 54 license = licenses.asl20; 55 maintainers = with maintainers; [ gravndal ]; 56 }; 57}