Skip to content

[ty] add TY_OUTPUT_FORMAT#23123

Merged
carljm merged 3 commits intoastral-sh:mainfrom
rbange:feat/ty-output-format
Feb 7, 2026
Merged

[ty] add TY_OUTPUT_FORMAT#23123
carljm merged 3 commits intoastral-sh:mainfrom
rbange:feat/ty-output-format

Conversation

@rbange
Copy link
Contributor

@rbange rbange commented Feb 6, 2026

Summary

fixes astral-sh/ty#2361

Test Plan

$ cargo run --bin ty -- check test.py
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.26s
     Running `target/debug/ty check test.py`
WARN No python files found under the given path(s)
error[io]: `/Users/.../ruff/test.py`: No such file or directory (os error 2)

Found 1 diagnostic
$ TY_OUTPUT_FORMAT=github cargo run --bin ty -- check test.py
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.25s
     Running `target/debug/ty check test.py`
WARN No python files found under the given path(s)
::error title=ty (io)::io: `/Users/.../ruff/test.py`: No such file or directory (os error 2)

@rbange rbange requested a review from carljm as a code owner February 6, 2026 16:16
Copilot AI review requested due to automatic review settings February 6, 2026 16:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for configuring ty check’s diagnostic output format via the TY_OUTPUT_FORMAT environment variable, aligning behavior with the existing --output-format CLI flag and documenting the new env var.

Changes:

  • Added EnvVars::TY_OUTPUT_FORMAT to the shared env var definitions.
  • Wired TY_OUTPUT_FORMAT into clap parsing for ty check --output-format.
  • Documented TY_OUTPUT_FORMAT in the environment variable docs and CLI reference.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
crates/ty_static/src/env_vars.rs Defines the new TY_OUTPUT_FORMAT environment variable constant and documentation.
crates/ty/src/args.rs Enables parsing --output-format from TY_OUTPUT_FORMAT via clap.
crates/ty/docs/environment.md Documents the new TY_OUTPUT_FORMAT env var for users.
crates/ty/docs/cli.md Reflects the new env var support in the CLI reference output-format section.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ntBre ntBre added the ty Multi-file analysis & type inference label Feb 6, 2026
@AlexWaygood AlexWaygood changed the title feat: add TY_OUTPUT_FORMAT [ty] add TY_OUTPUT_FORMAT Feb 6, 2026
@AlexWaygood AlexWaygood added the cli Related to the command-line interface label Feb 6, 2026
@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 6, 2026

Typing conformance results

No changes detected ✅

@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 6, 2026

mypy_primer results

Changes were detected when running on open source projects
Expression (https://github.com/cognitedata/Expression)
- tests/test_compose.py:21:16: error[invalid-assignment] Object of type `(Never, /) -> Never` is not assignable to `(int, /) -> int`
- Found 201 diagnostics
+ Found 200 diagnostics

setuptools (https://github.com/pypa/setuptools)
- setuptools/_distutils/command/install.py:719:42: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Iterable[Never]`, found `map[str]`
- Found 1140 diagnostics
+ Found 1139 diagnostics

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/deployments/runner.py:1017:70: warning[possibly-missing-attribute] Attribute `__name__` may be missing on object of type `Unknown | ((...) -> Any)`
+ src/prefect/deployments/runner.py:1017:70: warning[possibly-missing-attribute] Attribute `__name__` may be missing on object of type `Unknown | (((...) -> Any) & ((*args: object, **kwargs: object) -> object))`
- src/prefect/flow_engine.py:1004:32: error[invalid-await] `Unknown | R@FlowRunEngine | Coroutine[Any, Any, R@FlowRunEngine]` is not awaitable
- src/prefect/flow_engine.py:1610:24: error[invalid-await] `Unknown | R@AsyncFlowRunEngine | Coroutine[Any, Any, R@AsyncFlowRunEngine]` is not awaitable
- src/prefect/flow_engine.py:1691:43: error[invalid-argument-type] Argument to function `next` is incorrect: Expected `SupportsNext[Unknown]`, found `Unknown | R@run_generator_flow_sync`
- src/prefect/flow_engine.py:1699:21: warning[possibly-missing-attribute] Attribute `throw` may be missing on object of type `Unknown | R@run_generator_flow_sync`
- src/prefect/flow_engine.py:1733:44: warning[possibly-missing-attribute] Attribute `__anext__` may be missing on object of type `Unknown | R@run_generator_flow_async`
- src/prefect/flow_engine.py:1740:25: warning[possibly-missing-attribute] Attribute `throw` may be missing on object of type `Unknown | R@run_generator_flow_async`
- src/prefect/flows.py:285:34: error[unresolved-attribute] Object of type `(**P@Flow) -> R@Flow` has no attribute `__name__`
+ src/prefect/flows.py:285:34: error[unresolved-attribute] Object of type `((**P@Flow) -> R@Flow) & ((*args: object, **kwargs: object) -> object)` has no attribute `__name__`
- src/prefect/flows.py:403:68: error[unresolved-attribute] Object of type `(**P@Flow) -> R@Flow` has no attribute `__name__`
+ src/prefect/flows.py:403:68: error[unresolved-attribute] Object of type `((**P@Flow) -> R@Flow) & ((*args: object, **kwargs: object) -> object)` has no attribute `__name__`
- src/prefect/flows.py:1945:21: error[no-matching-overload] No overload of function `run_coro_as_sync` matches arguments
+ src/prefect/flows.py:1885:53: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- Found 5468 diagnostics
+ Found 5462 diagnostics

sympy (https://github.com/sympy/sympy)
+ sympy/parsing/mathematica.py:692:38: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Iterable[Never]`, found `Unknown | list[Unknown | str]`
- Found 15785 diagnostics
+ Found 15786 diagnostics

materialize (https://github.com/MaterializeInc/materialize)
+ misc/python/materialize/cli/mz_workload_anonymize.py:251:13: error[no-matching-overload] No overload of bound method `join` matches arguments
- Found 534 diagnostics
+ Found 535 diagnostics

No memory usage changes detected ✅

Copy link
Contributor

@carljm carljm left a comment

Choose a reason for hiding this comment

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

Thank you!

@carljm carljm merged commit 56eb6b6 into astral-sh:main Feb 7, 2026
50 checks passed
@rbange rbange deleted the feat/ty-output-format branch February 10, 2026 16:10
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.

Ability to set output format with an environment variable

5 participants