Skip to content

Failing ty swallows previous stdout #20

Closed
astral-sh/uv
#21086

Description

@iamkhav

Description

Using the ty hook currently results in ty removing previous stdout if there is any type error (i.e. the hook is failing and displaying output).

Previously we had solved this by using the --no-progress option and doing something like

  - repo: local
    hooks:
      - id: typecheck
        name: ty typecheck
        types_or: [ python, toml ]
        language: python
        pass_filenames: false
        additional_dependencies: [ "ty==0.0.63" ]
        entry: uv run --frozen ty check --no-progress

but we really like the option of using ty-pre-commit because it means we can bump ty with pre-commit's autoupdate on our CI.

It looks to me like any additional args given are not effective.

  - repo: https://github.com/astral-sh/ty-pre-commit
    rev: v0.0.63
    hooks:
      - id: ty
        args: [--no-progress]

^ doesn't solve the issue

For example, this still results in colorful output:

  - repo: https://github.com/astral-sh/ty-pre-commit
    rev: v0.0.63
    hooks:
      - id: ty
        args: [--color, never, --no-progress]

Activity

  1. iamkhav commented on Jul 27, 2026

    @iamkhav
    Author

    It seems to me like this could be an upstream issue.

    uv check --quiet --preview-features=check-command --ty-version=0.0.63 --no-progress --color never
    

    ^ still displays color and a progress bar.

    Edit: To be clear, the above is the command being executed by ty-pre-commit with the two args I gave as an example in the issue description.

  2. AlexWaygood commented on Aug 13, 2026

    @AlexWaygood
    Member

    Thanks for the report! It looks to me like this is probably an upstream issue in uv check.

    With the arguments you're providing to the hook, the hook runs a command equivalent to:

    uv check --quiet --preview-features=check-command --ty-version=0.0.63 --no-progress --color never

    However, --no-progress and --color never currently apply only to uv itself. uv then starts ty as a separate ty check process without forwarding either setting to ty, so ty still displays its progress bar and colored output.

    The disappearing output is caused by the progress bar's cursor-movement and line-clearing escape sequences. Running ty check --no-progress --color never directly works because those options are passed to ty itself.

    I think the fix needs to happen in uv check: it should propagate the relevant terminal settings to the ty subprocess. Once that works, this hook should disable ty's progress bar by default.

    Until then, codex tells me that setting TERM=dumb when invoking your hook runner should avoid the problematic progress output:

    TERM=dumb pre-commit run --all-files
  3. added a commit that references this issue on Aug 13, 2026
    09d1aa5
  4. AlexWaygood commented on Aug 13, 2026

    @AlexWaygood
    Member

    This should be fixed in the first ty release that comes after the next uv release, if that makes sense

  5. iamkhav commented on Aug 14, 2026

    @iamkhav
    Author

    Thank you for your work! :)

  6. added a commit that references this issue on Sep 21, 2026
    f266aa0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions