about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/mypy/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/mypy/default.nix')
-rw-r--r--nixpkgs/pkgs/development/python-modules/mypy/default.nix55
1 files changed, 44 insertions, 11 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/mypy/default.nix b/nixpkgs/pkgs/development/python-modules/mypy/default.nix
index dbbcb30ffcec..149aefb9a57f 100644
--- a/nixpkgs/pkgs/development/python-modules/mypy/default.nix
+++ b/nixpkgs/pkgs/development/python-modules/mypy/default.nix
@@ -1,28 +1,58 @@
-{ 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 = "0.930";
+  disabled = pythonOlder "3.6";
 
-  src = fetchPypi {
-    inherit pname version;
-    sha256 = "069i9qnfanp7dn8df1vspnqb0flvsszzn22v00vj08nzlnd061yd";
+  src = fetchFromGitHub {
+    owner = "python";
+    repo = "mypy";
+    rev = "v${version}";
+    sha256 = "sha256-0yo6f9hRYFfwdfukOGNNTgPCIFO2MZdfMvzbci7FWRs=";
   };
 
-  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=";
+    })
+  ];
+
+  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 +62,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 ];
   };
 }