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

Deprecate V1 isort implementation in favor of improved V2 implementation #9267

Merged
merged 1 commit into from Mar 11, 2020

Conversation

Eric-Arellano
Copy link
Contributor

As explained in this deprecation message, the V2 isort implementation brings 4 main benefits compared to the V1 implementation:

▶ ./pants --v2 fmt src/python/pants/util:strutil
/Users/eric/DocsLocal/code/projects/pants/src/python/pants/init/options_initializer.py:64: DeprecationWarning: DEPRECATED: The V1 isort implementation will be removed in version 1.29.0.dev0.
The original isort implementation is being replaced by an improved implementation made possible by the V2 engine. This new implementation brings these benefits:

  1. Avoids unnecessary prework. This new implementation should be faster to run.
  2. Has less verbose output. Pants will now only show what isort itself outputs. (Use --v2-ui if you want to see the work Pants is doing behind-the-scenes.)
  3. Works with ./pants lint automatically. When you run ./pants lint, Pants will run isort in check-only mode.
  4. Works with precise file arguments. If you say ./pants fmt f1.py, Pants will only run over the file f1.py, whereas the old implementation would run over every file belonging to the target that owns f1.py.

To prepare for this change, add to the GLOBAL section in your pants.toml the line backend_packages.remove = ['pants.backend.python.lint.isort'] (or backend_packages = -['pants.backend.python.lint.isort'] to your pants.ini). Then, if you still want to use isort, add backend_packages2.add = ['pants.backend.python.lint.isort'] to pants.toml or backend_packages2 = +['pants.backend.python.lint.isort'] to your pants.ini. Ensure that you have --v2 enabled (the default value).

Important detail: V2 isort will work even without V2 pants.backend.python enabled. Also, we now have --v2 on by default. So, things should work as soon as adding backend_packages2.add = ['pants.backend.python.lint.isort'].

Beyond an improved user experience, this reduces the amount of code we need to maintain and means that the majority of Python users will now be using V2!

Copy link
Contributor Author

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

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

The sole concern I have about this change is that the first-time experience is pretty underwhelming due to needing to build the requirements Pex, which takes 10-30 seconds. Maybe we proactively warn that the first run will be slow, but it will be much faster after?

@Eric-Arellano Eric-Arellano merged commit c520f6c into pantsbuild:master Mar 11, 2020
@Eric-Arellano Eric-Arellano deleted the deprecate-v1-isort branch March 11, 2020 23:52
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

3 participants