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