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

Feature Request: Add option to force __future__ import of absolute_imports #727

Closed
nickwilliams-eventbrite opened this issue Jul 26, 2018 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@nickwilliams-eventbrite

We would like to force all of the Python files in our project (if and only if they contain other import statements) to contain from __future__ import absolute_import (or add absolute_import if it's missing in an already-existing __future__ import). A new setting for isort to instruct it to add absolute_import whenever needed would be a great feature.

@bpedersen2
Copy link

While adding the future import with the -a commandline flag is already possible, it would be nice if there would be an equivalent option for configfiles to validate that new files also include the appropriate imports.

@timothycrosley timothycrosley added enhancement New feature or request help wanted Extra attention is needed labels Feb 17, 2020
@timothycrosley
Copy link
Member

This is now supported in develop and will be released with isort 5.2.0.

via CLI:

isort --add-import `from __future__ import absolute_import` --append-only

or via config:

add_imports=from __future__ import absolute_import
append_only=true

@timothycrosley
Copy link
Member

This was just deployed with version 5.2.0 of isort. Thanks!

~Timothy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants