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