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
Relative import management #1014
Comments
Yeah, I think so... Right now, we support the "forbid relative imports of parent modules" rule from Does that sound right? Is there any tool or combination of tools you use today to enforce this? |
I think the autofix should be both ways for case 1:
For this case I am using For case 3: This one should be the default: forbid relative imports and rewrite them as absolute as autofix. This is basically the deault behavior of Case 2 is bonus to me but I have some cases of child-to-parent dependencies I want to keep relative. The idea it to flag a package as relative-root for its children using
I took a look at
|
Note that |
Which cases are not covered by the |
I submitted a PR for my missing case as well as a matching one on |
Sorry if this is not the right place to ask: the docs (https://docs.astral.sh/ruff/rules/relative-imports/) say that
When is that autofix available exactly? I'm looking at automatically converting relative imports to absolute ones. I have the relevant rule enabled: [flake8-tidy-imports]
ban-relative-imports = "all" Is such an autofix planned/accepted in Ruff? |
This topic has always been a bit painful to manage with
isort
orabsolufy-imports
and given I am migrating all my project toruff
I would love to be able to tune the relative imports ahndling:..
starting imports)Is it something acceptable ?
Note: I am motivated enough to contribute but not yet skilled enough in Rust to make this happen soon
The text was updated successfully, but these errors were encountered: