Skip to content

[ty] Add --exclude-scripts and --include-scripts - #27169

Merged
Gankra merged 1 commit into
mainfrom
gankra/ty-exclude-scripts-flag
Jul 24, 2026
Merged

[ty] Add --exclude-scripts and --include-scripts#27169
Gankra merged 1 commit into
mainfrom
gankra/ty-exclude-scripts-flag

Conversation

@Gankra

@Gankra Gankra commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

This is a 3rd pseudo-alternative to

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).

@Gankra
Gankra requested review from a team as code owners July 24, 2026 18:44
@Gankra Gankra added the ty Multi-file analysis & type inference label Jul 24, 2026
@astral-sh-bot
astral-sh-bot Bot requested a review from charliermarsh July 24, 2026 18:44
Comment thread crates/ty/src/lib.rs Outdated

project.set_verbose(&mut db, verbosity >= VerbosityLevel::Verbose);
project.set_force_exclude(&mut db, force_exclude);
project.set_exclude_scripts(&mut db, exclude_scripts);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I guess that's fine for now. We might want to move it, once we support setting it via configuration

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nah let's do it right, I just don't know what I'm doing with config x3

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm okay deferring. It may even be easier if the config option has a different name (e.g. scripts = true/false).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm also a big fan of only adding config options once people ask for them :)

@MichaReiser MichaReiser added ci Related to internal CI tooling cli Related to the command-line interface and removed ci Related to internal CI tooling labels 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)

@Gankra
Gankra force-pushed the gankra/ty-exclude-scripts-flag branch from 5690e31 to 0a59fe1 Compare July 24, 2026 18:52
Comment thread crates/ty/src/args.rs Outdated
)]
exclude_scripts: Option<bool>,
#[clap(long, overrides_with("exclude_scripts"), hide = true)]
no_exclude_scripts: bool,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think I'd prefer --include-scripts here

@Gankra
Gankra force-pushed the gankra/ty-exclude-scripts-flag branch from 0a59fe1 to 9e45650 Compare July 24, 2026 18:58
@Gankra
Gankra requested a review from a team as a code owner July 24, 2026 18:58
@Gankra
Gankra force-pushed the gankra/ty-exclude-scripts-flag branch from 9e45650 to 8dddb4a Compare July 24, 2026 18:59
@Gankra Gankra changed the title [ty] Add --exclude-scripts [ty] Add --exclude-scripts and --include-scripts Jul 24, 2026
@Gankra
Gankra merged commit 995db7c into main Jul 24, 2026
69 of 70 checks passed
@Gankra
Gankra deleted the gankra/ty-exclude-scripts-flag branch July 24, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli Related to the command-line interface ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants