Repository navigation
Use ruff to also sort imports - #3237
Conversation
MyreMylar
left a comment
There was a problem hiding this comment.
Seems reasonable to me.
I'd rather have these automagically sorted in a consistent manner aligned with python coding standards than having to figure it out myself.
…written elsewhere (e.g., the CPython repository)
|
I added back the missing import and also rewrote the method to how I've seen it typically typed out elsewhere, such as the CPython repository: https://github.com/search?q=repo%3Apython%2Fcpython%20%22classmethod(types.GenericAlias)%22&type=code |
|
Does the import sorting not also apply to stub files? |
Nope, |
|
There's a little TODO still left:
|
|
I assumed that would be a separate PR, but I guess it could be put with this one for convenience, placing the large changes together. |
|
This configuration should properly configure the ruff configuration: [tool.ruff]
extend-exclude = [
"buildconfig/*.py", # *.pyi stub files still included
"docs/reST",
"setup.py",
]Alternatively, |
Both options have a flaw I dislike, with the exclude it's not being quite as specific, for example, if there were other That said, considering that the reason we don't want I did consult |
aatle
left a comment
There was a problem hiding this comment.
LGTM; thanks!
(Before merging, pull in from main and run pre-commit so that tests pass.)


Just a capability that was not being utilized (it was done before when we were using
black+isort)From
ruffdocs: