Repository navigation
Support uv check - #5435
Open
kinto0 wants to merge 3 commits into
Open
Support uv check#5435kinto0 wants to merge 3 commits into
uv check#5435kinto0 wants to merge 3 commits into
Conversation
Summary: Stack context: Check PEP 723 scripts in their own uv environments, and let `uv check` select files by path, as it does for ty. - Add a per-file callback to `ConfigFinder`. It receives the config found for a Python file and may return a config for that file alone. `ConfigFinder::new_constant_with_file` gives a constant finder the same callback. All existing finders pass the config through unchanged. - A PEP 723 script runs in its own environment, so it needs a different interpreter from the other files under the same config. Today a config finder can only return a config per directory. Differential Revision: D127959345
Summary: Stack context: Check PEP 723 scripts in their own uv environments, and let `uv check` select files by path, as it does for ty. - Add the `use-uv` config option. For each checked file with a `# /// script` block, Pyrefly runs `uv workspace metadata --script <file>` and checks the file with the interpreter of the environment that uv reports. Every other setting comes from the file's config, and every other file keeps the configured or discovered interpreter. - Today Pyrefly checks a script with the project's interpreter, so it cannot import the script's own dependencies. ty reads script environments from the same `uv workspace metadata` contract (astral-sh/uv#22941). This is the alternative to the `uv` build system in D127889580: uv selects files by path and Pyrefly reads only environments from uv, so Pyrefly never lists a member's files. - Pyrefly never creates or updates a script's environment. If it does not exist, Pyrefly warns and checks the script with its directory config. Each script's config is cached until the file's modification time or its directory config changes. Differential Revision: D127959383
Summary: Stack context: Check PEP 723 scripts in their own uv environments, and let `uv check` select files by path, as it does for ty. - Add `pyrefly check --exclude-scripts`. Pyrefly skips the files with a PEP 723 `# /// script` block that it finds in the project or in the given directories, and still checks files given explicitly. - `uv check` checks a project without its scripts, which must be checked with `uv check --script`. ty finds the scripts in its own walk and skips them with the same flag, so uv only passes the flag. Without it, uv must find the scripts itself and pass each one as `--project-excludes`. Differential Revision: D128114982
Contributor
|
@kinto0 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D128114982. |
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
rchen152
approved these changes
Oct 30, 2026
rchen152
left a comment
Contributor
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary:
Stack context: Check PEP 723 scripts in their own uv environments, and let
uv checkselect files by path, as it does for ty.pyrefly check --exclude-scripts. Pyrefly skips the files with a PEP 723# /// scriptblock that it finds in the project or in the given directories, and still checks files given explicitly.uv checkchecks a project without its scripts, which must be checked withuv check --script. ty finds the scripts in its own walk and skips them with the same flag, so uv only passes the flag. Without it, uv must find the scripts itself and pass each one as--project-excludes.Differential Revision: D128114982