Skip to content

[ty] Skip implicitly discovered PEP 723 scripts in uv workspaces - #27165

Closed
Gankra wants to merge 1 commit into
mainfrom
gankra/ty-skip-implicit-uv-scripts
Closed

[ty] Skip implicitly discovered PEP 723 scripts in uv workspaces#27165
Gankra wants to merge 1 commit into
mainfrom
gankra/ty-skip-implicit-uv-scripts

Conversation

@Gankra

@Gankra Gankra commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

As discussed in #25551 this is a followup to force ty to ignore pep 723 scripts that "happen" to be discovered under a package that it was told to use by uv check.

Thus to check any scripts with uv check you must use uv check --script path/to/script.py (and users can get the list of paths to do that for with uv workspace list --scripts).

"Full" uv check thus looks like:

#!/usr/bin/env bash
set -uo pipefail

status=0

uv check --all-packages --all-groups --all-extras || status=1

while IFS= read -r script; do
    uv check --script "$script" || status=1
done < <(uv workspace list --scripts)

exit "$status"

In the future we may or may not add more optimized UX for this, but this reflects the way uv thinks about package/script selection.

@Gankra
Gankra requested review from a team as code owners July 24, 2026 16:58
@astral-sh-bot
astral-sh-bot Bot requested a review from MichaReiser July 24, 2026 16:58
@Gankra Gankra added the ty Multi-file analysis & type inference label Jul 24, 2026
@astral-sh-bot

astral-sh-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

Typing conformance results

No changes detected ✅

Current numbers
The percentage of diagnostics emitted that were expected errors held steady at 96.84%. The percentage of expected errors that received a diagnostic held steady at 92.11%. The number of fully passing files held steady at 99/133.

@astral-sh-bot

astral-sh-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

Memory usage report

Memory usage unchanged ✅

@astral-sh-bot

astral-sh-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

ecosystem-analyzer results

No diagnostic changes detected ✅

Flaky changes detected. This PR summary excludes flaky changes; see the HTML report for details.

Full report with detailed diff (timing results)

@zsol

zsol commented Jul 24, 2026

Copy link
Copy Markdown
Member

This is great!

Gankra added a commit that referenced this pull request Jul 24, 2026
This is a 3rd pseudo-alternative to 

* astral-sh/uv#20676
* #27165

which @MichaReiser suggested as a way to ask for the desired behaviour
that becomes "standard API" and not like, some random "oh are we doing
uv?" escape-hatch.

Notably here a PEP 723 script is only excluded if it's "implicitly
selected" in much the same way that this still checks `bar.py`: `ty
check --exclude foo/ -- foo/bar.py`

`--include-scripts` is the default and exists only to negate
`--exclude-scripts` in e.g. config-vs-cli-arg fights (and maybe will be
nice if we ever change the default).
@MichaReiser

Copy link
Copy Markdown
Member

I'd prefer #27169

@Gankra

Gankra commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favour of astral-sh/uv#20676 which can be simplified with #27169 but doesn't strictly need to block on it.

@Gankra Gankra closed this Jul 24, 2026
Gankra added a commit to astral-sh/uv that referenced this pull request Jul 27, 2026
…20676)

This is an alternative version of
astral-sh/ruff#27165 where all the logic lives
in uv and ty can keep its innocence.

As mentioned in that PR, with this "full" uv check thus looks like:

```sh
#!/usr/bin/env bash
set -uo pipefail

status=0

uv check --all-packages --all-groups --all-extras || status=1

while IFS= read -r script; do
    uv check --script "$script" || status=1
done < <(uv workspace list --scripts)

exit "$status"
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants