python310Packages.mypy: 0.991 -> 1.0.1
https://mypy-lang.blogspot.com/2023/02/mypy-10-released.html - Organize dependencies - Apply patch for setuptools 67.4.0 support - Use env to pass environment vars explicitly - Enable tests, disable tests that ignore our PYTHONPATH
This commit is contained in:
parent
0cf801fa81
commit
e6937f6684
@ -1,47 +1,72 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, attrs
|
||||
, buildPythonPackage
|
||||
, filelock
|
||||
, lxml
|
||||
, mypy-extensions
|
||||
, psutil
|
||||
, py
|
||||
, pytest-forked
|
||||
, pytest-xdist
|
||||
, pytestCheckHook
|
||||
, python
|
||||
, fetchFromGitHub
|
||||
, fetchpatch
|
||||
, pythonOlder
|
||||
|
||||
# build-system
|
||||
, setuptools
|
||||
, six
|
||||
, typed-ast
|
||||
, typing-extensions
|
||||
, tomli
|
||||
, types-psutil
|
||||
, types-setuptools
|
||||
, types-typed-ast
|
||||
, types-psutil
|
||||
, virtualenv
|
||||
|
||||
# propagates
|
||||
, mypy-extensions
|
||||
, tomli
|
||||
, typing-extensions
|
||||
|
||||
# optionals
|
||||
, lxml
|
||||
, psutil
|
||||
|
||||
# tests
|
||||
, attrs
|
||||
, filelock
|
||||
, pytest-xdist
|
||||
, pytest-forked
|
||||
, pytestCheckHook
|
||||
, py
|
||||
, six
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "mypy";
|
||||
version = "0.991";
|
||||
version = "1.0.1";
|
||||
format = "pyproject";
|
||||
|
||||
disabled = pythonOlder "3.7";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "python";
|
||||
repo = "mypy";
|
||||
rev = "refs/tags/v${version}";
|
||||
hash = "sha256-ljnMlQUlz4oiZqlqOlqJOumrP6wKLDGiDtT3Y5OEQog=";
|
||||
hash = "sha256-vxPEUDC6fkYYiOl5nHf0qwMgPDC+9Vw56eTUQ174raQ=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# Fix compatibility with setupptools>=67.4.0
|
||||
(fetchpatch {
|
||||
# https://github.com/python/mypy/pull/14781
|
||||
url = "https://github.com/python/mypy/commit/ab7b69a0532a5fe976c9c2a1b713d82d630692a4.patch";
|
||||
hash = "sha256-dtzmoOZP3tOtxrBVhgqpdv+rnrTjTKHxQhBieuJXRtA=";
|
||||
})
|
||||
(fetchpatch {
|
||||
# https://github.com/python/mypy/pull/14787
|
||||
url = "https://github.com/AlexWaygood/mypy/commit/8e459eab40ac0fae9740e985ee4aeb348cde28c5.patch";
|
||||
hash = "sha256-R7DU6MFnaeHPobUb8ADhssTKDwdPBXBhDN2mxrrQ51M=";
|
||||
})
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
mypy-extensions
|
||||
setuptools
|
||||
types-typed-ast
|
||||
types-setuptools
|
||||
types-psutil
|
||||
types-setuptools
|
||||
types-typed-ast
|
||||
typing-extensions
|
||||
] ++ lib.optionals (pythonOlder "3.11") [
|
||||
tomli
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
@ -49,17 +74,24 @@ buildPythonPackage rec {
|
||||
typing-extensions
|
||||
] ++ lib.optionals (pythonOlder "3.11") [
|
||||
tomli
|
||||
] ++ lib.optionals (pythonOlder "3.8") [
|
||||
typed-ast
|
||||
];
|
||||
|
||||
passthru.optional-dependencies = {
|
||||
dmypy = [ psutil ];
|
||||
reports = [ lxml ];
|
||||
dmypy = [
|
||||
psutil
|
||||
];
|
||||
reports = [
|
||||
lxml
|
||||
];
|
||||
};
|
||||
|
||||
# TODO: enable tests
|
||||
doCheck = false;
|
||||
# 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.
|
||||
# is64bit: unfortunately the build would exhaust all possible memory on i686-linux.
|
||||
env.MYPY_USE_MYPYC = stdenv.buildPlatform.is64bit;
|
||||
|
||||
# when testing reduce optimisation level to reduce build time by 20%
|
||||
env.MYPYC_OPT_LEVEL = 1;
|
||||
|
||||
pythonImportsCheck = [
|
||||
"mypy"
|
||||
@ -73,13 +105,25 @@ buildPythonPackage rec {
|
||||
"mypy.report"
|
||||
];
|
||||
|
||||
# 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.
|
||||
# is64bit: unfortunately the build would exhaust all possible memory on i686-linux.
|
||||
MYPY_USE_MYPYC = stdenv.buildPlatform.is64bit;
|
||||
checkInputs = [
|
||||
attrs
|
||||
filelock
|
||||
pytest-xdist
|
||||
pytest-forked
|
||||
pytestCheckHook
|
||||
py
|
||||
setuptools
|
||||
six
|
||||
tomli
|
||||
] ++ lib.flatten (lib.attrValues passthru.optional-dependencies);
|
||||
|
||||
# when testing reduce optimisation level to drastically reduce build time
|
||||
MYPYC_OPT_LEVEL = 1;
|
||||
disabledTestPaths = [
|
||||
# fails to find tyoing_extensions
|
||||
"mypy/test/testcmdline.py"
|
||||
"mypy/test/testdaemon.py"
|
||||
# fails to find setuptools
|
||||
"mypyc/test/test_commandline.py"
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Optional static typing for Python";
|
||||
|
Loading…
Reference in New Issue
Block a user