Open TerryRPatterson opened 5 months ago
Do you mind providing a concrete example? Aren't relative imports always within the same package? How would they belong to a different section?
Sure, I have a custom section defined:
[lint.isort]
section-order=[
"future",
"standard-library",
"third-party",
"first-party",
"local-folder",
"extra-types",
]
[lint.isort.sections]
extra-types=['.types.extras.*']
and when applied to this file:
from .types.path import Path
from .types.pyobject import PyObject
from .types.string import String
from .types.struct_reference import StructReference
# Types wrapping optional dependencies
from .types.extras.secret import Secret
from .types.extras.url import Url
It wants to sort the .types.extras
import into the middle of the local-folder section.
Forgot to include this in the initial post. I really appreciate the work y'all have put into ruff and uv they are both awesome tools.
At the moment, imports having an import level greater than zero are always classified as a local folder import, even if they match a pattern specified in the sections configuration.
It would be nice if the sections check had higher priority than local folders.
I have a couple of imports which need to be in a different section to call out that they are wrappers around optional deps.