1{
2 lib,
3 fetchFromGitHub,
4 buildPythonPackage,
5 pytest-cov-stub,
6 pytestCheckHook,
7 pythonOlder,
8 setuptools,
9 typing-extensions,
10}:
11
12buildPythonPackage rec {
13 pname = "multidict";
14 version = "6.1.0";
15
16 disabled = pythonOlder "3.8";
17
18 pyproject = true;
19
20 src = fetchFromGitHub {
21 owner = "aio-libs";
22 repo = "multidict";
23 rev = "refs/tags/v${version}";
24 hash = "sha256-rvL1XzMNBVBlElE5wznecL3Ku9h4tG9VeqGRd04iPXw=";
25 };
26
27 postPatch = ''
28 # `python3 -I -c "import multidict"` fails with ModuleNotFoundError
29 substituteInPlace tests/test_circular_imports.py \
30 --replace-fail '"-I",' ""
31 '';
32
33 build-system = [ setuptools ];
34
35 dependencies = lib.optionals (pythonOlder "3.11") [
36 typing-extensions
37 ];
38
39 nativeCheckInputs = [
40 pytest-cov-stub
41 pytestCheckHook
42 ];
43
44 preCheck = ''
45 # import from $out
46 rm -r multidict
47 '';
48
49 pythonImportsCheck = [ "multidict" ];
50
51 meta = with lib; {
52 changelog = "https://github.com/aio-libs/multidict/blob/v${version}/CHANGES.rst";
53 description = "Multidict implementation";
54 homepage = "https://github.com/aio-libs/multidict/";
55 license = licenses.asl20;
56 maintainers = with maintainers; [ dotlambda ];
57 };
58}