From afc927262eaa1ca4957a2fed5cfc7cb8c9e161f9 Mon Sep 17 00:00:00 2001 From: Ben Caimano Date: Fri, 12 Oct 2018 11:34:53 -0400 Subject: [PATCH] SERVER-37588 Python linters version incompatability --- buildscripts/linter/pylint.py | 2 +- etc/evergreen.yml | 11 ++++++----- etc/pip/components/lint.req | 9 ++++----- etc/pip/components/mypy.req | 4 +++- etc/pip/constraints.txt | 18 ++++++++---------- mypy.ini | 5 ++--- 6 files changed, 24 insertions(+), 25 deletions(-) diff --git a/buildscripts/linter/pylint.py b/buildscripts/linter/pylint.py index 12dbcfdf6d3..71a062f9076 100644 --- a/buildscripts/linter/pylint.py +++ b/buildscripts/linter/pylint.py @@ -15,7 +15,7 @@ class PyLintLinter(base.LinterBase): def __init__(self): # type: () -> None """Create a pylint linter.""" - super(PyLintLinter, self).__init__("pylint", "pylint 1.8.3") + super(PyLintLinter, self).__init__("pylint", "pylint 1.9.3") def get_lint_version_cmd_args(self): # type: () -> List[str] diff --git a/etc/evergreen.yml b/etc/evergreen.yml index 256d978219b..d8d246a0625 100644 --- a/etc/evergreen.yml +++ b/etc/evergreen.yml @@ -4336,17 +4336,18 @@ tasks: set -o verbose ${activate_virtualenv} - python3 -m pip install -r etc/pip/lint-requirements.txt - python2 -m pip install -r etc/pip/lint-requirements.txt + python3 -m pip install -I -r etc/pip/lint-requirements.txt + python2 -m pip install -I -r etc/pip/lint-requirements.txt export MYPY="$( - PATH+=':/opt/mongodbtoolchain/v2/bin' if command -V cygpath 2>/dev/null; then PATH+=":$(cypath "${workdir}")/venv_3/Scripts" else PATH+=":${workdir}/venv_3/bin" fi + PATH+=':/opt/mongodbtoolchain/v2/bin' which mypy )" + echo "Found mypy executable at '$MYPY'" ${compile_env|} python2 ./buildscripts/scons.py ${compile_flags|} --stack-size=1024 lint - name: verify_pip @@ -4370,8 +4371,8 @@ tasks: ${activate_virtualenv} # This installs the explicit project versions which would be installed in the toolchain # from this patch - python2 -m pip install -r etc/pip/constraints.txt - python3 -m pip install -r etc/pip/constraints.txt + python2 -m pip install -I -r etc/pip/constraints.txt + python3 -m pip install -I -r etc/pip/constraints.txt python2 -m pip freeze >requirements.txt.python2.old python3 -m pip freeze >requirements.txt.python3.old diff --git a/etc/pip/components/lint.req b/etc/pip/components/lint.req index 74f244638b7..2b9ea36bc9d 100644 --- a/etc/pip/components/lint.req +++ b/etc/pip/components/lint.req @@ -1,6 +1,5 @@ # Linters -pylint -yapf -# typing in Python 2 for mypy -typing; python_version < "3" -pydocstyle +# Note: These versions are checked by python modules in buildscripts/linter/ +pylint == 1.9.3 +yapf == 0.21.0 +pydocstyle == 2.1.1 diff --git a/etc/pip/components/mypy.req b/etc/pip/components/mypy.req index 16bd01c175c..fcf8ad90f2a 100644 --- a/etc/pip/components/mypy.req +++ b/etc/pip/components/mypy.req @@ -1 +1,3 @@ -mypy == 0.620; python_version > "3.4" +# Note: This version is checked by python modules in buildscripts/linter/ +mypy == 0.580; python_version > "3.4" +typing diff --git a/etc/pip/constraints.txt b/etc/pip/constraints.txt index 8176b262b8a..10dabb89676 100644 --- a/etc/pip/constraints.txt +++ b/etc/pip/constraints.txt @@ -6,9 +6,10 @@ # Common requirements asn1crypto==0.24.0 -boto3==1.9.21 -botocore==1.12.21 -certifi==2018.8.24 +astroid==1.6.5 +boto3==1.9.23 +botocore==1.12.23 +certifi==2018.10.15 cffi==1.11.5 chardet==3.0.4 cryptography==2.3 @@ -28,6 +29,7 @@ psutil==5.4.7 pycparser==2.19 pydocstyle==2.1.1 PyJWT==1.6.4 +pylint==1.9.3 pymongo==3.5.1 python-dateutil==2.7.3 PyYAML==3.13 @@ -39,12 +41,12 @@ requests-toolbelt==0.8.0 s3transfer==0.1.13 six==1.11.0 snowballstemmer==1.2.1 +typing==3.6.6 urllib3==1.23 wrapt==1.10.11 -yapf==0.24.0 +yapf==0.21.0 # Python2 requirements -astroid==1.6.5; python_version < "3" backports.functools-lru-cache==1.5; python_version < "3" Cheetah3==3.1.0; python_version < "3" configparser==3.5.0; python_version < "3" @@ -54,14 +56,10 @@ futures==3.2.0; python_version < "3" ipaddress==1.0.22; python_version < "3" mock==2.0.0; python_version < "3" PyKMIP==0.4.0; python_version < "3" -pylint==1.9.3; python_version < "3" singledispatch==3.4.0.3; python_version < "3" -typing==3.6.6; python_version < "3" # Python3 requirements -astroid==2.0.4; python_version > "3" -mypy==0.620; python_version > "3" -pylint==2.1.1; python_version > "3" +mypy==0.580; python_version > "3" typed-ast==1.1.0; python_version > "3" # Platform-specific components diff --git a/mypy.ini b/mypy.ini index 7d3f3753832..8cf0f9075b2 100644 --- a/mypy.ini +++ b/mypy.ini @@ -2,7 +2,6 @@ # Check Python 2 code for type annotations in comments. python_version = 2.7 -[mypy-*] disallow_untyped_defs = False # Do not error on imported files since all imported files may not be mypy clean. follow_imports = silent @@ -11,10 +10,10 @@ follow_imports = silent # This will limit effectiveness but avoids mypy complaining about running code. ignore_missing_imports = True -[mypy-idl*] +[mypy-idl.*] # Error if any code is missing type annotations. disallow_untyped_defs = True -[mypy-lint*] +[mypy-lint.*] # Error if any code is missing type annotations. disallow_untyped_defs = True