Skip to content

Commit

Permalink
Fix setuptools's Python 2 deprecation warning with Python linters (#9131
Browse files Browse the repository at this point in the history
)

Setuptools 45.x is the last to support Python 2. It has an incredibly noisy stderr message to make sure users are aware of this:

```
/private/var/folders/sx/pdpbqz4x5cscn9hhfpbsbqvm0000gn/T/process-executionUnBXvi/pex_root/install/setuptools-45.2.0-py2-none-any.whl.91f9e7e571716e18411266133f3db5a0212dfa92/setuptools-45.2.0-py2-none-any.whl/pkg_resources/py2_warn.py:22: UserWarning: Setuptools will stop working on Python 2
************************************************************
You are running Setuptools on Python 2, which is no longer
supported and
>>> SETUPTOOLS WILL STOP WORKING <<<
in a subsequent release (no sooner than 2020-04-20).
Please ensure you are installing
Setuptools using pip 9.x or later or pin to `setuptools<45`
in your environment.
If you have done those things and are still encountering
this message, please comment in
pypa/setuptools#1458
about the steps that led to this unsupported combination.
************************************************************
  sys.version_info < (3,) and warnings.warn(pre + "*" * 60 + msg + "*" * 60)
```

By tweaking our default versions, we can make sure our users don't get this noise when running `./pants fmt2` and `./pants lint2`.
  • Loading branch information
Eric-Arellano authored Feb 14, 2020
1 parent 2e20a1d commit 2126ce5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/python/pants/backend/python/lint/bandit/subsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

class Bandit(PythonToolBase):
options_scope = 'bandit'
default_version = 'bandit'
default_extra_requirements = ['setuptools']
default_version = 'bandit>=1.6.2,<1.7'
default_extra_requirements = ['setuptools<45'] # `<45` is for Python 2 support
default_entry_point = 'bandit'
default_interpreter_constraints = ["CPython>=2.7,<3", "CPython>=3.0"]

Expand Down
2 changes: 1 addition & 1 deletion src/python/pants/backend/python/lint/black/subsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class Black(PythonToolBase):
options_scope = 'black'
default_version = 'black==19.3b0'
default_version = 'black==19.10b0'
default_extra_requirements = ['setuptools']
default_entry_point = 'black:patched_main'
default_interpreter_constraints = ["CPython>=3.6"]
Expand Down
4 changes: 2 additions & 2 deletions src/python/pants/backend/python/lint/flake8/subsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

class Flake8(PythonToolBase):
options_scope = 'flake8'
default_version = 'flake8'
default_extra_requirements = ['setuptools']
default_version = 'flake8>=3.7.9,<3.8'
default_extra_requirements = ['setuptools<45'] # `<45` is for Python 2 support
default_entry_point = 'flake8'
default_interpreter_constraints = ["CPython>=2.7,<3", "CPython>=3.4"]

Expand Down
4 changes: 2 additions & 2 deletions src/python/pants/backend/python/lint/isort/subsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

class Isort(PythonToolBase):
options_scope = 'isort'
default_version = 'isort==4.3.20'
default_extra_requirements = ['setuptools']
default_version = 'isort>=4.3.21,<4.4'
default_extra_requirements = ['setuptools<45'] # NB: `<45` is for Python 2 support
default_entry_point = 'isort.main'

@classmethod
Expand Down

0 comments on commit 2126ce5

Please sign in to comment.