2021-12-06 16:07:01 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
2022-09-14 18:05:37 +00:00
|
|
|
, attrs
|
2021-12-06 16:07:01 +00:00
|
|
|
, buildPythonPackage
|
2022-09-14 18:05:37 +00:00
|
|
|
, filelock
|
|
|
|
, lxml
|
2020-04-24 23:36:52 +00:00
|
|
|
, mypy-extensions
|
2022-09-14 18:05:37 +00:00
|
|
|
, psutil
|
|
|
|
, py
|
|
|
|
, pytest-forked
|
|
|
|
, pytest-xdist
|
|
|
|
, pytestCheckHook
|
2021-12-06 16:07:01 +00:00
|
|
|
, python
|
|
|
|
, pythonOlder
|
2022-09-30 11:47:45 +00:00
|
|
|
, setuptools
|
2022-09-14 18:05:37 +00:00
|
|
|
, six
|
2021-12-06 16:07:01 +00:00
|
|
|
, typed-ast
|
2020-04-24 23:36:52 +00:00
|
|
|
, typing-extensions
|
2021-12-06 16:07:01 +00:00
|
|
|
, tomli
|
|
|
|
, types-typed-ast
|
2022-09-14 18:05:37 +00:00
|
|
|
, virtualenv
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
2021-12-06 16:07:01 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "mypy";
|
2022-09-14 18:05:37 +00:00
|
|
|
version = "0.971";
|
|
|
|
format = "pyproject";
|
|
|
|
disabled = pythonOlder "3.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "python";
|
|
|
|
repo = "mypy";
|
2022-09-14 18:05:37 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-J1lUnJco9rLYgFpJkfujGfVq1CfC4pdvvDzoan3jGkU=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-09-14 18:05:37 +00:00
|
|
|
nativeBuildInputs = [
|
2022-09-30 11:47:45 +00:00
|
|
|
setuptools
|
2021-12-06 16:07:01 +00:00
|
|
|
types-typed-ast
|
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
mypy-extensions
|
2022-09-14 18:05:37 +00:00
|
|
|
typing-extensions
|
|
|
|
] ++ lib.optionals (pythonOlder "3.11") [
|
2021-12-06 16:07:01 +00:00
|
|
|
tomli
|
2022-09-14 18:05:37 +00:00
|
|
|
] ++ lib.optionals (pythonOlder "3.8") [
|
2021-12-06 16:07:01 +00:00
|
|
|
typed-ast
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-09-14 18:05:37 +00:00
|
|
|
passthru.optional-dependencies = {
|
|
|
|
dmypy = [ psutil ];
|
|
|
|
reports = [ lxml ];
|
|
|
|
};
|
|
|
|
|
|
|
|
# TODO: enable tests
|
2020-04-24 23:36:52 +00:00
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
pythonImportsCheck = [
|
|
|
|
"mypy"
|
|
|
|
"mypy.api"
|
|
|
|
"mypy.fastparse"
|
|
|
|
"mypy.report"
|
2021-12-06 16:07:01 +00:00
|
|
|
"mypy.types"
|
2020-12-29 15:07:52 +00:00
|
|
|
"mypyc"
|
|
|
|
"mypyc.analysis"
|
|
|
|
];
|
|
|
|
|
|
|
|
# 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.
|
2021-01-05 17:05:55 +00:00
|
|
|
# is64bit: unfortunately the build would exhaust all possible memory on i686-linux.
|
|
|
|
MYPY_USE_MYPYC = stdenv.buildPlatform.is64bit;
|
2020-12-29 15:07:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
# when testing reduce optimisation level to drastically reduce build time
|
|
|
|
MYPYC_OPT_LEVEL = 1;
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Optional static typing for Python";
|
2021-12-06 16:07:01 +00:00
|
|
|
homepage = "http://www.mypy-lang.org";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ martingms lnl7 SuperSandro2000 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|