1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 buildPythonPackage,
6 objgraph,
7 psutil,
8 pytestCheckHook,
9 pytest-codspeed,
10 pytest-cov-stub,
11 pythonOlder,
12 setuptools,
13 typing-extensions,
14}:
15
16buildPythonPackage rec {
17 pname = "multidict";
18 version = "6.6.4";
19 pyproject = true;
20
21 src = fetchFromGitHub {
22 owner = "aio-libs";
23 repo = "multidict";
24 tag = "v${version}";
25 hash = "sha256-Ewxwz+0Y8pXJpHobLxrV7cuA9fsAaawWmW9XoEg7dxU=";
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 env =
41 { }
42 // lib.optionalAttrs stdenv.cc.isClang {
43 NIX_CFLAGS_COMPILE = "-Wno-error=unused-command-line-argument";
44 };
45
46 nativeCheckInputs = [
47 objgraph
48 psutil
49 pytestCheckHook
50 pytest-codspeed
51 pytest-cov-stub
52 ];
53
54 preCheck = ''
55 # import from $out
56 rm -r multidict
57 '';
58
59 pythonImportsCheck = [ "multidict" ];
60
61 meta = with lib; {
62 changelog = "https://github.com/aio-libs/multidict/blob/${src.tag}/CHANGES.rst";
63 description = "Multidict implementation";
64 homepage = "https://github.com/aio-libs/multidict/";
65 license = licenses.asl20;
66 maintainers = with maintainers; [ dotlambda ];
67 };
68}