30 buildPythonPackage rec {
35 disabled = pythonOlder "3.8";
37 src = fetchFromGitHub {
40 rev = "refs/tags/${version}";
41 hash = "sha256-uOOZX8bKRunTOgYVbmetu2m0B7kijxBgWdNiLCAhiQ4=";
51 ] ++ lib.optionals (pythonOlder "3.11") [
58 ] ++ lib.optionals (pythonOlder "3.11") [
62 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)
98 ] ++ lib.flatten (lib.attrValues optional-dependencies);
101 # fails with typing-extensions>=4.10
102 # https://github.com/python/mypy/issues/17005
103 "test_runtime_typing_objects"
104 ] ++ lib.optionals (pythonAtLeast "3.12") [
109 disabledTestPaths = [
110 # fails to find tyoing_extensions
111 "mypy/test/testcmdline.py"
112 "mypy/test/testdaemon.py"
113 # fails to find setuptools
114 "mypyc/test/test_commandline.py"
115 # fails to find hatchling
116 "mypy/test/testpep561.py"
117 ] ++ lib.optionals stdenv.hostPlatform.isi686 [
118 # https://github.com/python/mypy/issues/15221
119 "mypyc/test/test_run.py"
123 description = "Optional static typing for Python";
124 homepage = "https://www.mypy-lang.org";
125 license = licenses.mit;
126 mainProgram = "mypy";
127 maintainers = with maintainers; [ lnl7 ];