Skip to content

[ruff] docs: Clarify first-party import detection in Ruff#23591

Merged
amyreese merged 1 commit intoastral-sh:mainfrom
thejcannon:patch-1
Feb 26, 2026
Merged

[ruff] docs: Clarify first-party import detection in Ruff#23591
amyreese merged 1 commit intoastral-sh:mainfrom
thejcannon:patch-1

Conversation

@thejcannon
Copy link
Contributor

@thejcannon thejcannon commented Feb 26, 2026

Summary

Clarify the explanation of how Ruff determines first-party imports based on Python package structure.

This behavior kinda makes sense (if you consider implicit namespace packages implying the Python package is potentially "not-this-package"), but is also surprising.

(See #23590 for some context)

Test Plan

N/A - its docs

Clarify the explanation of how Ruff determines first-party imports based on Python package structure.
@thejcannon
Copy link
Contributor Author

thejcannon commented Feb 26, 2026

Alternatively, happy to make a PR to remove the "requires a __init__.py file" logic, which IMHO is likely more aligned with user intent (even considering namespace packages, since after all it might not be our Python package, but is still "first party").

@amyreese amyreese self-assigned this Feb 26, 2026
@amyreese amyreese merged commit 625b4f5 into astral-sh:main Feb 26, 2026
40 checks passed
@amyreese amyreese added the documentation Improvements or additions to documentation label Feb 26, 2026
@thejcannon thejcannon deleted the patch-1 branch February 26, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants