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

Apply new repo-review suggestion RF003 #12937

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

DimitriPapadopoulos
Copy link
Contributor

@DimitriPapadopoulos DimitriPapadopoulos commented Aug 24, 2024

RF003: src directory doesn't need to be specified anymore (0.6+)

Ruff now (0.6+) looks in the src directory by default. The src setting doesn't need to be specified if it's just set to ["src"].

CAVEAT: Removing src = ["src"] results in changes related to the I rules, as suggested by the 0.6.0 release announcement;

By default, our isort rules now search inside src/ directories when determining the list of package names that are likely to represent first-party code. This was always configurable, but it was suprising for many users that Ruff didn't understand this common project structure "out of the box".

This change may result in some of your imports being reordered or recategorised, as import statements that these rules previously considered to be third-party imports will now be correctly understood as first-party.

RF003: src directory doesn't need to be specified anymore (0.6+)

Ruff now (0.6+) looks in the src directory by default. The src
setting doesn't need to be specified if it's just set to `["src"]`.
@DimitriPapadopoulos DimitriPapadopoulos marked this pull request as draft August 24, 2024 19:00
@DimitriPapadopoulos DimitriPapadopoulos marked this pull request as ready for review August 24, 2024 19:10
@DimitriPapadopoulos DimitriPapadopoulos changed the title Apply repo-review suggestion RF003 Apply new repo-review suggestion RF003 Aug 24, 2024
@notatallshaw
Copy link
Member

notatallshaw commented Aug 24, 2024

I tried this myself after seeing the ruff changelog but it produces wrong import sorting, from pip._vendor.* is supposed to be marked as 3rd party as per the config:

known-third-party = ["pip._vendor"]

But this PR moves pip._vendor.* to be first party with pip._internal.*. This is either a bug in ruff or something in the ruff config needs to be updated.

@DimitriPapadopoulos
Copy link
Contributor Author

Indeed, this doesn't seem right. Pehraps related to astral-sh/ruff#10266.

@notatallshaw
Copy link
Member

OP in that issue says known-third-party is a workaround for their issue, but in this example known-third-party is not helping.

It might be the same as this astral-sh/ruff#12984.

@uranusjr uranusjr added the skip news Does not need a NEWS file entry (eg: trivial changes) label Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news Does not need a NEWS file entry (eg: trivial changes)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants