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 { lib
, stdenv , stdenv
, fetchFromGitHub , fetchFromGitHub
, fetchpatch , attrs
, buildPythonPackage , buildPythonPackage
, filelock
, lxml
, mypy-extensions , mypy-extensions
, psutil
, py
, pytest-forked
, pytest-xdist
, pytestCheckHook
, python , python
, pythonOlder , pythonOlder
, six
, typed-ast , typed-ast
, typing-extensions , typing-extensions
, tomli , tomli
, types-typed-ast , types-typed-ast
, virtualenv
}: }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "mypy"; pname = "mypy";
version = "0.961"; version = "0.971";
disabled = pythonOlder "3.6"; format = "pyproject";
disabled = pythonOlder "3.7";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "python"; owner = "python";
repo = "mypy"; repo = "mypy";
rev = "v${version}"; rev = "refs/tags/v${version}";
hash = "sha256-K6p73+/SeWniMSD/mP09qwqFOBr/Pqohl+PaTDVpvZI="; hash = "sha256-J1lUnJco9rLYgFpJkfujGfVq1CfC4pdvvDzoan3jGkU=";
}; };
patches = [ nativeBuildInputs = [
# 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 = [
types-typed-ast types-typed-ast
]; ];
propagatedBuildInputs = [ propagatedBuildInputs = [
mypy-extensions mypy-extensions
tomli
typed-ast
typing-extensions 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; doCheck = false;
pythonImportsCheck = [ pythonImportsCheck = [

View file

@ -2,7 +2,8 @@
, fetchFromGitHub , fetchFromGitHub
, buildPythonPackage , buildPythonPackage
, typing , typing
, unittestCheckHook , pytestCheckHook
, pythonAtLeast
, pythonOlder , pythonOlder
}: }:
@ -19,11 +20,23 @@ buildPythonPackage rec {
propagatedBuildInputs = lib.optional (pythonOlder "3.5") typing; 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; { meta = with lib; {
description = "Experimental type system extensions for programs checked with the mypy typechecker"; description = "Experimental type system extensions for programs checked with the mypy typechecker";