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

[red-knot] Use vendored typeshed stubs for stdlib module resolution #12224

Merged
merged 6 commits into from
Jul 9, 2024

Conversation

AlexWaygood
Copy link
Member

Summary

If the user does not pass a --custom-typeshed-dir flag via the CLI or via a configuration flag, fall back to using the VendoredFileSystem to resolve standard-library modules in the module resolver. Work towards #11653.

(This PR is stacked on top of #12215)

Test Plan

I added a test to resolver.rs that demonstrates that vendored files now work

@AlexWaygood AlexWaygood added the red-knot Multi-file analysis & type inference label Jul 7, 2024
Copy link
Contributor

github-actions bot commented Jul 7, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good.

I would prefer if we can avoid introducing a FilePathRef, see the inline comment why and a solution on how we can avoid it.

Overall, I start to like Carl's recommendation more and more. I think the current design makes some transformation unnecessarily verbose. But I'm okay moving forward with this (but would prefer for Carl to have a look at the PR as well)

crates/ruff_db/src/vendored/path.rs Outdated Show resolved Hide resolved
crates/ruff_db/src/vendored/path.rs Outdated Show resolved Hide resolved
crates/ruff_db/src/vendored/path.rs Outdated Show resolved Hide resolved
crates/red_knot_module_resolver/src/db.rs Outdated Show resolved Hide resolved
crates/red_knot_module_resolver/src/db.rs Show resolved Hide resolved
crates/red_knot_module_resolver/src/typeshed/versions.rs Outdated Show resolved Hide resolved
crates/ruff_db/src/files/path.rs Outdated Show resolved Hide resolved
crates/red_knot_module_resolver/src/path.rs Show resolved Hide resolved
@AlexWaygood AlexWaygood force-pushed the module-resolver-vendored-paths-2 branch 4 times, most recently from 6ee4e7c to 3fb2a25 Compare July 8, 2024 12:30
evanrittenhouse pushed a commit to evanrittenhouse/ruff that referenced this pull request Jul 8, 2024
evanrittenhouse pushed a commit to evanrittenhouse/ruff that referenced this pull request Jul 8, 2024
evanrittenhouse pushed a commit to evanrittenhouse/ruff that referenced this pull request Jul 8, 2024
crates/red_knot_module_resolver/src/path.rs Show resolved Hide resolved
crates/red_knot_module_resolver/src/path.rs Outdated Show resolved Hide resolved
@AlexWaygood AlexWaygood force-pushed the module-resolver-vendored-paths-2 branch from f17899f to d9a40d7 Compare July 8, 2024 19:26
@MichaReiser MichaReiser force-pushed the files-use-absolute-paths branch 2 times, most recently from d9a54da to f3818a2 Compare July 9, 2024 07:36
Base automatically changed from files-use-absolute-paths to main July 9, 2024 07:52
An error occurred while trying to automatically change base from files-use-absolute-paths to main July 9, 2024 07:52
@AlexWaygood AlexWaygood force-pushed the module-resolver-vendored-paths-2 branch from 4ee6b8f to 31a22fd Compare July 9, 2024 09:17
@AlexWaygood AlexWaygood enabled auto-merge (squash) July 9, 2024 09:18
@AlexWaygood AlexWaygood merged commit 6fa4e32 into main Jul 9, 2024
18 checks passed
@AlexWaygood AlexWaygood deleted the module-resolver-vendored-paths-2 branch July 9, 2024 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
red-knot Multi-file analysis & type inference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants