31 buildPythonPackage rec {
36 disabled = pythonOlder "3.7";
38 src = fetchFromGitHub {
41 rev = "refs/tags/v${version}";
42 hash = "sha256-qs+axm2+UWNuWzLW8CI4qBV7k7Ra8gBajid8mYKDsso=";
51 ] ++ lib.optionals (pythonOlder "3.11") [
55 propagatedBuildInputs = [
58 ] ++ lib.optionals (pythonOlder "3.11") [
62 passthru.optional-dependencies = {
71 # Compile mypy with mypyc, which makes mypy about 4 times faster. The compiled
72 # version is also the default in the wheels on Pypi that include binaries.
73 # is64bit: unfortunately the build would exhaust all possible memory on i686-linux.
74 env.MYPY_USE_MYPYC = stdenv.buildPlatform.is64bit;
76 # when testing reduce optimisation level to reduce build time by 20%
77 env.MYPYC_OPT_LEVEL = 1;
79 pythonImportsCheck = [
86 ] ++ lib.optionals (!stdenv.hostPlatform.isi686) [
87 # ImportError: cannot import name 'map_instance_to_supertype' from partially initialized module 'mypy.maptype' (most likely due to a circular import)
101 ] ++ lib.flatten (lib.attrValues passthru.optional-dependencies);
103 disabledTestPaths = [
104 # fails to find tyoing_extensions
105 "mypy/test/testcmdline.py"
106 "mypy/test/testdaemon.py"
107 # fails to find setuptools
108 "mypyc/test/test_commandline.py"
109 # fails to find hatchling
110 "mypy/test/testpep561.py"
111 ] ++ lib.optionals stdenv.hostPlatform.isi686 [
112 # https://github.com/python/mypy/issues/15221
113 "mypyc/test/test_run.py"
117 description = "Optional static typing for Python";
118 homepage = "https://www.mypy-lang.org";
119 license = licenses.mit;
120 mainProgram = "mypy";
121 maintainers = with maintainers; [ martingms lnl7 ];