feat: add back PEP 420 support behind feature flag #808
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.
Relates to #740.
PR Checklist
docs
is updatedDescription of changes
Add back support for namespace package (PEP 420) that was reverted in #798 because of a performance degradation on large codebases.
2 changes in this new implementation:
--experimental-namespace-package
), so it should not be considered stable (but people that relied on this new feature will at least be able to opt back in)os.walk
to stop on the first Python file we found, rather than using the expensivePath.rglob
, which will loop through all directoriesThe performance degradation could still probably be noticeable on projects that are prone to have a directory with a huge amount of nested non-Python directories (for instance
node_modules
).As possible future improvements:
_is_local_module
if we need to do so, avoiding irrelevant directories that don't match any known import