at 23.05-pre 2.0 kB view raw
1{ lib 2, stdenv 3, fetchFromGitHub 4, attrs 5, buildPythonPackage 6, filelock 7, lxml 8, mypy-extensions 9, psutil 10, py 11, pytest-forked 12, pytest-xdist 13, pytestCheckHook 14, python 15, pythonOlder 16, setuptools 17, six 18, typed-ast 19, typing-extensions 20, tomli 21, types-setuptools 22, types-typed-ast 23, virtualenv 24}: 25 26buildPythonPackage rec { 27 pname = "mypy"; 28 version = "0.981"; 29 format = "pyproject"; 30 disabled = pythonOlder "3.7"; 31 32 src = fetchFromGitHub { 33 owner = "python"; 34 repo = "mypy"; 35 rev = "refs/tags/v${version}"; 36 hash = "sha256-CkRK/j5DRUZU2enpZtqX4l+89E7ODDG9MeRYFQp9kSs="; 37 }; 38 39 nativeBuildInputs = [ 40 setuptools 41 types-typed-ast 42 types-setuptools 43 ]; 44 45 propagatedBuildInputs = [ 46 mypy-extensions 47 typing-extensions 48 ] ++ lib.optionals (pythonOlder "3.11") [ 49 tomli 50 ] ++ lib.optionals (pythonOlder "3.8") [ 51 typed-ast 52 ]; 53 54 passthru.optional-dependencies = { 55 dmypy = [ psutil ]; 56 reports = [ lxml ]; 57 }; 58 59 # TODO: enable tests 60 doCheck = false; 61 62 pythonImportsCheck = [ 63 "mypy" 64 "mypy.api" 65 "mypy.fastparse" 66 "mypy.types" 67 "mypyc" 68 "mypyc.analysis" 69 ] ++ lib.optionals (!stdenv.hostPlatform.isi686) [ 70 # ImportError: cannot import name 'map_instance_to_supertype' from partially initialized module 'mypy.maptype' (most likely due to a circular import) 71 "mypy.report" 72 ]; 73 74 # Compile mypy with mypyc, which makes mypy about 4 times faster. The compiled 75 # version is also the default in the wheels on Pypi that include binaries. 76 # is64bit: unfortunately the build would exhaust all possible memory on i686-linux. 77 MYPY_USE_MYPYC = stdenv.buildPlatform.is64bit; 78 79 # when testing reduce optimisation level to drastically reduce build time 80 MYPYC_OPT_LEVEL = 1; 81 82 meta = with lib; { 83 description = "Optional static typing for Python"; 84 homepage = "http://www.mypy-lang.org"; 85 license = licenses.mit; 86 maintainers = with maintainers; [ martingms lnl7 SuperSandro2000 ]; 87 }; 88}