Merge pull request #191084 from mweinelt/python311-mypy-fixes

This commit is contained in:
Martin Weinelt 2022-09-14 01:21:43 +02:00 committed by GitHub
commit 1d6779560d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 22 deletions

View file

@ -1,50 +1,58 @@
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, attrs
, buildPythonPackage
, filelock
, lxml
, mypy-extensions
, psutil
, py
, pytest-forked
, pytest-xdist
, pytestCheckHook
, python
, pythonOlder
, six
, typed-ast
, typing-extensions
, tomli
, types-typed-ast
, virtualenv
}:
buildPythonPackage rec {
pname = "mypy";
version = "0.961";
disabled = pythonOlder "3.6";
version = "0.971";
format = "pyproject";
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "python";
repo = "mypy";
rev = "v${version}";
hash = "sha256-K6p73+/SeWniMSD/mP09qwqFOBr/Pqohl+PaTDVpvZI=";
rev = "refs/tags/v${version}";
hash = "sha256-J1lUnJco9rLYgFpJkfujGfVq1CfC4pdvvDzoan3jGkU=";
};
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/2004ae023b9d3628d9f09886cbbc20868aee8554.patch";
hash = "sha256-y+tXvgyiECO5+66YLvaje8Bz5iPvfWNIBJcsnZ2nOdI=";
})
];
buildInputs = [
nativeBuildInputs = [
types-typed-ast
];
propagatedBuildInputs = [
mypy-extensions
tomli
typed-ast
typing-extensions
] ++ lib.optionals (pythonOlder "3.11") [
tomli
] ++ lib.optionals (pythonOlder "3.8") [
typed-ast
];
# Tests not included in pip package.
passthru.optional-dependencies = {
dmypy = [ psutil ];
reports = [ lxml ];
};
# TODO: enable tests
doCheck = false;
pythonImportsCheck = [

View file

@ -2,7 +2,8 @@
, fetchFromGitHub
, buildPythonPackage
, typing
, unittestCheckHook
, pytestCheckHook
, pythonAtLeast
, pythonOlder
}:
@ -19,11 +20,23 @@ buildPythonPackage rec {
propagatedBuildInputs = lib.optional (pythonOlder "3.5") typing;
checkInputs = [ unittestCheckHook ];
# make the testsuite run with pytest, so we can disable individual tests
checkInputs = [
pytestCheckHook
];
unittestFlagsArray = [ "tests" ];
pytestFlagsArray = [
"tests/testextensions.py"
];
pythonImportsCheck = [ "mypy_extensions" ];
disabledTests = lib.optionals (pythonAtLeast "3.11") [
# https://github.com/python/mypy_extensions/issues/24
"test_typeddict_errors"
];
pythonImportsCheck = [
"mypy_extensions"
];
meta = with lib; {
description = "Experimental type system extensions for programs checked with the mypy typechecker";