diff options
Diffstat (limited to 'pkgs/development/python-modules/mypy/default.nix')
-rw-r--r-- | pkgs/development/python-modules/mypy/default.nix | 60 |
1 files changed, 49 insertions, 11 deletions
diff --git a/pkgs/development/python-modules/mypy/default.nix b/pkgs/development/python-modules/mypy/default.nix index dbbcb30ffce..99580e2de37 100644 --- a/pkgs/development/python-modules/mypy/default.nix +++ b/pkgs/development/python-modules/mypy/default.nix @@ -1,28 +1,63 @@ -{ lib, stdenv, fetchPypi, buildPythonPackage, typed-ast, psutil, isPy3k +{ lib +, stdenv +, fetchFromGitHub +, fetchpatch +, buildPythonPackage , mypy-extensions +, python +, pythonOlder +, typed-ast , typing-extensions +, tomli +, types-typed-ast }: + buildPythonPackage rec { pname = "mypy"; - version = "0.812"; - disabled = !isPy3k; + version = "unstable-2021-11-14"; + disabled = pythonOlder "3.6"; - src = fetchPypi { - inherit pname version; - sha256 = "069i9qnfanp7dn8df1vspnqb0flvsszzn22v00vj08nzlnd061yd"; + src = fetchFromGitHub { + owner = "python"; + repo = "mypy"; + rev = "053a1beb94ee4e5b3260725594315d1b6776e42f"; + sha256 = "sha256-q2ntj3y3GgXrw4v+yMvcqWFv4y/6YwunIj3bNzU9CH0="; }; - propagatedBuildInputs = [ typed-ast psutil mypy-extensions typing-extensions ]; + patches = [ + # FIXME: Remove patch after upstream has decided the proper solution. + # https://github.com/python/mypy/pull/11143 + (fetchpatch { + url = "https://github.com/python/mypy/commit/f1755259d54330cd087cae763cd5bbbff26e3e8a.patch"; + sha256 = "sha256-5gPahX2X6+/qUaqDQIGJGvh9lQ2EDtks2cpQutgbOHk="; + }) + ]; + + postPatch = '' + substituteInPlace setup.py \ + --replace "tomli>=1.1.0,<1.2.0" "tomli" + ''; + + buildInputs = [ + types-typed-ast + ]; + + propagatedBuildInputs = [ + mypy-extensions + tomli + typed-ast + typing-extensions + ]; # Tests not included in pip package. doCheck = false; pythonImportsCheck = [ "mypy" - "mypy.types" "mypy.api" "mypy.fastparse" "mypy.report" + "mypy.types" "mypyc" "mypyc.analysis" ]; @@ -32,10 +67,13 @@ buildPythonPackage rec { # is64bit: unfortunately the build would exhaust all possible memory on i686-linux. MYPY_USE_MYPYC = stdenv.buildPlatform.is64bit; + # when testing reduce optimisation level to drastically reduce build time + MYPYC_OPT_LEVEL = 1; + meta = with lib; { description = "Optional static typing for Python"; - homepage = "http://www.mypy-lang.org"; - license = licenses.mit; - maintainers = with maintainers; [ martingms lnl7 ]; + homepage = "http://www.mypy-lang.org"; + license = licenses.mit; + maintainers = with maintainers; [ martingms lnl7 SuperSandro2000 ]; }; } |