Unify Python project root detection logic #10082
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After #9547 and #10031, we have way too many setup.py checks in the code base and cause inconsistencies across different components. I did a global search for
setup.py
and tried to consolidate all of them into usingis_installable_dir()
, and fixed the error messages, docstrings, and comments to keep up with the logic.Fix #10080 (a symptom to the issue).
The definition of a valid project root is now containing either a
pyproject.toml
(PEP 517; further file signifier like setup.py/setup.cfg are performed by the backend) orsetup.py
. Asetup.cfg
-only layout is only available if there is also apyproject.toml
(and we don’t check for that except inparse_editable
; this is already implemented in #9547 and not included in this PR).