2021-09-23 23:02:15 -03:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
2022-09-13 18:20:15 +02:00
|
|
|
, attrs
|
2021-09-23 23:02:15 -03:00
|
|
|
, buildPythonPackage
|
2022-09-13 18:20:15 +02:00
|
|
|
, filelock
|
|
|
|
, lxml
|
2019-10-24 09:56:26 +02:00
|
|
|
, mypy-extensions
|
2022-09-13 18:20:15 +02:00
|
|
|
, psutil
|
|
|
|
, py
|
|
|
|
, pytest-forked
|
|
|
|
, pytest-xdist
|
|
|
|
, pytestCheckHook
|
2021-09-23 23:02:15 -03:00
|
|
|
, python
|
|
|
|
, pythonOlder
|
2022-09-15 12:53:12 +02:00
|
|
|
, setuptools
|
2022-09-13 18:20:15 +02:00
|
|
|
, six
|
2021-09-23 23:02:15 -03:00
|
|
|
, typed-ast
|
2019-10-24 09:56:26 +02:00
|
|
|
, typing-extensions
|
2021-09-23 23:02:15 -03:00
|
|
|
, tomli
|
2022-10-02 12:55:43 +02:00
|
|
|
, types-setuptools
|
2021-09-23 23:02:15 -03:00
|
|
|
, types-typed-ast
|
2022-11-26 00:36:40 +01:00
|
|
|
, types-psutil
|
2022-09-13 18:20:15 +02:00
|
|
|
, virtualenv
|
2019-10-24 09:56:26 +02:00
|
|
|
}:
|
2021-09-23 23:02:15 -03:00
|
|
|
|
2018-05-25 10:42:34 +01:00
|
|
|
buildPythonPackage rec {
|
2017-05-11 22:33:34 +02:00
|
|
|
pname = "mypy";
|
2022-11-26 00:36:40 +01:00
|
|
|
version = "0.991";
|
2022-09-13 18:20:15 +02:00
|
|
|
format = "pyproject";
|
|
|
|
disabled = pythonOlder "3.7";
|
2016-07-11 19:35:00 +02:00
|
|
|
|
2021-09-23 23:02:15 -03:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "python";
|
|
|
|
repo = "mypy";
|
2022-09-13 18:20:15 +02:00
|
|
|
rev = "refs/tags/v${version}";
|
2022-11-26 00:36:40 +01:00
|
|
|
hash = "sha256-ljnMlQUlz4oiZqlqOlqJOumrP6wKLDGiDtT3Y5OEQog=";
|
2016-07-11 19:35:00 +02:00
|
|
|
};
|
|
|
|
|
2022-09-13 18:20:15 +02:00
|
|
|
nativeBuildInputs = [
|
2022-09-15 12:53:12 +02:00
|
|
|
setuptools
|
2021-09-23 23:02:15 -03:00
|
|
|
types-typed-ast
|
2022-10-02 12:55:43 +02:00
|
|
|
types-setuptools
|
2022-11-26 00:36:40 +01:00
|
|
|
types-psutil
|
2021-09-23 23:02:15 -03:00
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
mypy-extensions
|
2022-09-13 18:20:15 +02:00
|
|
|
typing-extensions
|
|
|
|
] ++ lib.optionals (pythonOlder "3.11") [
|
2021-09-23 23:02:15 -03:00
|
|
|
tomli
|
2022-09-13 18:20:15 +02:00
|
|
|
] ++ lib.optionals (pythonOlder "3.8") [
|
2021-09-23 23:02:15 -03:00
|
|
|
typed-ast
|
|
|
|
];
|
2016-07-12 11:22:24 +02:00
|
|
|
|
2022-09-13 18:20:15 +02:00
|
|
|
passthru.optional-dependencies = {
|
|
|
|
dmypy = [ psutil ];
|
|
|
|
reports = [ lxml ];
|
|
|
|
};
|
|
|
|
|
|
|
|
# TODO: enable tests
|
2019-12-15 18:56:06 -08:00
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
pythonImportsCheck = [
|
|
|
|
"mypy"
|
|
|
|
"mypy.api"
|
|
|
|
"mypy.fastparse"
|
2021-09-23 23:02:15 -03:00
|
|
|
"mypy.types"
|
2020-11-30 14:38:55 +01:00
|
|
|
"mypyc"
|
|
|
|
"mypyc.analysis"
|
2022-10-12 13:00:01 +02:00
|
|
|
] ++ lib.optionals (!stdenv.hostPlatform.isi686) [
|
|
|
|
# ImportError: cannot import name 'map_instance_to_supertype' from partially initialized module 'mypy.maptype' (most likely due to a circular import)
|
|
|
|
"mypy.report"
|
2020-11-30 14:38:55 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
# Compile mypy with mypyc, which makes mypy about 4 times faster. The compiled
|
|
|
|
# version is also the default in the wheels on Pypi that include binaries.
|
2020-12-30 09:04:15 +01:00
|
|
|
# is64bit: unfortunately the build would exhaust all possible memory on i686-linux.
|
|
|
|
MYPY_USE_MYPYC = stdenv.buildPlatform.is64bit;
|
2020-11-30 14:38:55 +01:00
|
|
|
|
2021-09-23 23:02:15 -03:00
|
|
|
# when testing reduce optimisation level to drastically reduce build time
|
|
|
|
MYPYC_OPT_LEVEL = 1;
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2016-07-11 19:35:00 +02:00
|
|
|
description = "Optional static typing for Python";
|
2021-09-23 23:02:15 -03:00
|
|
|
homepage = "http://www.mypy-lang.org";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ martingms lnl7 SuperSandro2000 ];
|
2016-07-11 19:35:00 +02:00
|
|
|
};
|
|
|
|
}
|