-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Different import sorting order between isort and ruff if import is aliased. #1381
Comments
Good call, thank you. |
Related: PyCQA/isort#1952 |
Personally I like the ruff behavior more than the isort behavior. So I hope isort changes their behavior. |
I get a completely different sorting when using from abc import abstractmethod
from contextlib import contextmanager
from numpy import concatenate, int32, zeros
from traits.api import Dict, Float, Str, cached_property
import tapy.core.config as config
from tapy.core.base import BasicObject whereas from abc import abstractmethod
from contextlib import contextmanager
import tapy.core.config as config
from numpy import concatenate, int32, zeros
from tapy.core.base import BasicObject
from traits.api import Dict, Float, Str, cached_property Any idea what is going on here? I don't think it is an issue with my config. |
It looks like it’s not registering tapy as a first-party module. Would you mind posting your pyproject.toml and project structure? |
Hi. Thanks for the swift reply! Sure thing, I have a [project]
name = "tapy"
...
requires-python = ">=3.9"
...
dependencies = [
"tqdm",
"traits"
]
[project.optional-dependencies]
dev = [
"ipython",
"pre-commit",
"ruff",
"sphinx",
"sphinx-autoapi",
"nbsphinx",
"sphinx-rtd-theme",
"sphinx-gallery"
]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.ruff]
ignore = [
"D100", "D101", "D102", "D103", "D104", "D105", "D107",
"D203", "D213",
"B905",
"F401",
"N806"]
line-length = 120
select = ["B", "D", "E", "F", "I", "N", "Q", "W"]
[tool.ruff.flake8-quotes]
inline-quotes = "single"
[tool.ruff.pydocstyle]
convention = "numpy" |
Can you try adding the following? [tool.ruff]
src = ["src"] |
(By default, we use |
OK, so I just found the section in the readme regarding Thanks for helping out. I don't want to hijack this issue. If I encounter this problem again, I will give an update. For now, it seems to 'just work again'... |
(Is it possible you were missing an |
Yes, exactly I just found it out, too. I had an So either no |
No prob at all, glad it’s resolved! |
I added a note on this to the docs. I think I view this as a known, but acceptable deviation for now. |
Differnt import sorting order between isort and ruff if import is aliased.
The text was updated successfully, but these errors were encountered: