Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve source roots in MyPy and Pylint output #10159

Merged
merged 3 commits into from Jun 25, 2020

Conversation

Eric-Arellano
Copy link
Contributor

Before (Pylint):

bad.py:2:0: C0103

After (Pylint):

src/python/bad.py:2:0: C0103

# Delete this line to force CI to run Clippy and the Rust tests.
[ci skip-rust-tests]
# Delete this line to force CI to run the JVM tests.
[ci skip-jvm-tests]
# Delete this line to force CI to run Clippy and the Rust tests.
[ci skip-rust-tests]
# Delete this line to force CI to run the JVM tests.
[ci skip-jvm-tests]
# Delete this line to force CI to run Clippy and the Rust tests.
[ci skip-rust-tests]
# Delete this line to force CI to run the JVM tests.
[ci skip-jvm-tests]
Comment on lines -88 to +93
# TODO(#10131): figure out how to robustly handle interpreter constraints. Unlike other
# linters, the version of Python used to run MyPy can be different than the version of
# the code.
# NB: This only determines what MyPy is run with. The user can specify what version
# their code is with `--python-version`. See
# https://mypy.readthedocs.io/en/stable/config_file.html#platform-configuration. We do
# not auto-configure this for simplicity and to avoid Pants magically setting values for
# users.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is after discussion with Benjy yesterday.

There would be some complexities if Pants were to try to auto-configure --python-version:

  1. Difficult to actually do. MyPy expects a 2-digit number like 3.6, but our interpreter constraints express ranges like >3.6. It's not clear how to translate a more general constraint into something more specific.
  2. We would need to then validate that the user did not try setting this and is now conflicting with us. Sounds leaky.

@Eric-Arellano Eric-Arellano merged commit 785e906 into pantsbuild:master Jun 25, 2020
@Eric-Arellano Eric-Arellano deleted the mypy-dont-strip branch June 25, 2020 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants