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

Why remove-all-unused-imports isn't default behavior? #267

Closed
xeon826 opened this issue Jul 10, 2023 · 1 comment
Closed

Why remove-all-unused-imports isn't default behavior? #267

xeon826 opened this issue Jul 10, 2023 · 1 comment
Labels

Comments

@xeon826
Copy link

xeon826 commented Jul 10, 2023

I have this set in my pyproject.toml, and I see the doc states that there are cases that make this unsafe, can someone show me an example of code where this might break something?

@fsouza
Copy link
Collaborator

fsouza commented Jul 29, 2023

In Python, import a module executes code. If you have code that relies on import size effect, removing the import can break things.

Personally, I think that autoflake should still remove it, and users should use # noqa in cases like that, but I don't feel strongly enough about this to change the default. Changing defaults is always tricky.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants