🌐
GitHub
github.com › allganize › ty-pre-commit
GitHub - allganize/ty-pre-commit · GitHub
A pre-commit hook for Ty, an extremely fast Python type checker written in Rust.
Starred by 11 users
Forked by 2 users
Languages   Python
🌐
GitHub
github.com › astral-sh › ty › issues › 269
`pre-commit` hook for `ty` · Issue #269 · astral-sh/ty
May 8, 2025 - looking forward to the https://github.com/astral-sh/ruff-pre-commit equivalent for ty i understand ty is pre-release but i think there would be value in offering pre-commit integration even before ...
Author   astral-sh
Discussions

What are your favourite pre-commit hooks and why?
You may fancy me mad, but this is my standard python pre-commit stack: end-of-file-fixer trailing-whitespace fix-byte-order-marker mixed-line-ending name-tests-test no-commit-to-branch autoflake args: [ "--in-place", "--remove-unused-variables", "--remove-all-unused-imports" ] isort black cspell doc8 args: [ "--max-line-length", "112", "--file-encoding", "utf-8" ] flake8 additional_dependencies: [ flake8-pytest-style, flake8-bugbear, flake8-comprehensions, flake8-print, darglint ] bandit pylint More on reddit.com
🌐 r/Python
83
120
April 24, 2024
Add `ty` to `.pre-commit-config.yaml`
ty from Astral replaced mypy in #692 For now, no pre-commit hook exists for ty. After astral-sh/ty#269 is resolved, we can add ty in the document linked below: tqec/.pre-commit-config.yaml Lines 1 ... More on github.com
🌐 github.com
0
September 25, 2025
Ultra-Strict Python Template v3 — now with pre-commit automation
I will suggest try prek instead pre commit More on reddit.com
🌐 r/Python
19
7
December 27, 2025
What are your pre-commit hooks?
Please read our latest update. https://www.reddit.com/r/ExperiencedDevs/comments/142pwq9/sub_blackout_and_new_platform/ I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
🌐 r/ExperiencedDevs
118
87
June 8, 2023
People also ask

How do I run mypy or ty as a pre-commit hook?
For mypy, use the `pre-commit/mirrors-mypy` repo and add any needed type stubs to `additional_dependencies`, for example `[types-requests]`. For ty, use a local hook that calls `uvx ty check` with `language: system` and `pass_filenames: false`, which lets ty discover files itself and respect any exclude patterns in your ty configuration.
🌐
pydevtools.com
pydevtools.com › handbook › how-to › how-to-set-up-pre-commit-hooks-for-a-python-project
How to set up pre-commit hooks for a Python project | pydevtools
How do I run pre-commit hooks in CI?
Add a GitHub Actions step that runs `uvx pre-commit run --all-files` after `actions/checkout@v4` and `astral-sh/setup-uv@v7`. Hooks run locally, but contributors can skip them with `git commit --no-verify`. Running the same hooks in CI ensures every change is checked before merge regardless of how it was committed.
🌐
pydevtools.com
pydevtools.com › handbook › how-to › how-to-set-up-pre-commit-hooks-for-a-python-project
How to set up pre-commit hooks for a Python project | pydevtools
How do I configure Ruff as a pre-commit hook?
Add the `astral-sh/ruff-pre-commit` repo to `.pre-commit-config.yaml` with two hooks: `ruff-check` with `args: [--fix]` for the linter and `ruff-format` for the formatter. They run in order, so linting fixes are applied before formatting. Pin `rev:` to a current release tag and run `uvx pre-commit autoupdate` periodically to bump it.
🌐
pydevtools.com
pydevtools.com › handbook › how-to › how-to-set-up-pre-commit-hooks-for-a-python-project
How to set up pre-commit hooks for a Python project | pydevtools
🌐
Astral
docs.astral.sh › ty › reference › typing-faq
Typing FAQ | ty
3 days ago - Yes! You can find it over at https://github.com/astral-sh/ty-pre-commit.
🌐
GitHub
github.com › astral-sh › ty-pre-commit
GitHub - astral-sh/ty-pre-commit: A pre-commit hook for ty. · GitHub
Each hook revision pins both the corresponding ty version and the latest uv version that was available when that ty version was released. New ty releases trigger ty-pre-commit releases; new uv releases do not trigger releases on their own.
Author   astral-sh
🌐
PyDevTools
pydevtools.com › handbook › how-to › how-to-set-up-pre-commit-hooks-for-a-python-project
How to set up pre-commit hooks for a Python project | pydevtools
3 weeks ago - Add any type stub packages your project needs to additional_dependencies. For example, if your project uses requests: ... repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml - id: check-added-large-files ...
🌐
Lemonyte
lemonyte.com › blog › adopting-ty
Adopting ty in pre-commit hooks and CI | Lemonyte
December 18, 2025 - In the meantime, I’ve opted for a local hook instead of using someone else’s repo, in case it stops being maintained. If you want to give ty a spin in your pre-commit setup, you can add this to your .pre-commit-config.yaml:
🌐
GitHub
github.com › astral-sh › ty › blob › main › .pre-commit-config.yaml
ty/.pre-commit-config.yaml at main · astral-sh/ty
An extremely fast Python type checker and language server, written in Rust. - ty/.pre-commit-config.yaml at main · astral-sh/ty
Author   astral-sh
Find elsewhere
🌐
FSKY Foundry
foundry.fsky.io › vel › ty-pre-commit
vel/ty-pre-commit - ty-pre-commit - FSKY Foundry
- repo: https://foundry.fsky.io/vel/ty-pre-commit # ty version rev: 0.0.16 hooks: # run `ty check` - id: ty-check
🌐
PyDevTools
pydevtools.com › handbook › reference › ty
ty: Python Type Checker by OpenAI | pydevtools
1 day ago - repos: - repo: https://github.com/astral-sh/ty-pre-commit rev: v0.0.48 hooks: - id: ty
🌐
GitHub
github.com › hoxbro › ty-pre-commit
GitHub - hoxbro/ty-pre-commit · GitHub
Contribute to hoxbro/ty-pre-commit development by creating an account on GitHub.
Author   hoxbro
🌐
DEV Community
dev.to › s3cloudhub › git-python-workflow-mastery-with-uv-ruff-and-ty-a-modern-developers-guide-46ck
🚀 Git + Python Workflow Mastery with uv, ruff, and ty: A Modern Developer’s Guide - DEV Community
June 16, 2025 - ✅ Smarter Git ty\ removes the friction of commit writing · ✅ Better Collaboration Your teammates will love your clean diffs and atomic commits · Yes! Once installed, each tool is easy to use. Minimal configuration, maximum gain. Absolutely. Add ruff to .pre-commit-config.yaml and you’re set.
🌐
PyDevTools
pydevtools.com › blog › sync-with-uv-eliminate-pre-commit-version-drift
Sync with uv: Eliminate Pre-commit Version Drift | pydevtools
September 26, 2025 - The tool runs before other hooks, ensuring automatic version synchronization on every commit. ... sync-with-uv eliminates these issues by establishing uv.lock as the single source of truth for tool versions. For projects using both uv and pre-commit, sync-with-uv offers a clean solution to version management complexity.
🌐
GitHub
github.com › tqec › tqec › issues › 706
Add `ty` to `.pre-commit-config.yaml` · Issue #706 · tqec/tqec
September 25, 2025 - ty from Astral replaced mypy in #692 For now, no pre-commit hook exists for ty. After astral-sh/ty#269 is resolved, we can add ty in the document linked below: tqec/.pre-commit-config.yaml Lines 1 to 34 in 5ba3ff8 repos: - repo: https://...
Author   tqec
🌐
Reddit
reddit.com › r/python › ultra-strict python template v3 — now with pre-commit automation
r/Python on Reddit: Ultra-Strict Python Template v3 — now with pre-commit automation
December 27, 2025 -

I rebuilt my strict Python scaffold to be cleaner, stricter, and easier to drop into projects.

pystrict-strict-python
A TypeScript-style --strict experience for Python using:

  • uv

  • ruff

  • basedpyright

  • pre-commit

What’s in v3?

  • Single pyproject.toml as the source of truth

  • Stricter typing defaults (no implicit Any, explicit None, unused symbols = errors)

  • Aggressive lint/format rules via ruff

  • pytest + coverage (80% required)

  • Skylos for dead-code detection (better than Vulture)

  • Optional Pandera rules

  • Anti-LLM code smell checks

NEW: pre-commit automation

On commit:

  • ruff format + auto-fix lint

On push:

  • full lint validation + strict basedpyright check

Setup:

uv run pre-commit install
uv run pre-commit install --hook-type pre-push
uv run pre-commit autoupdate

Why?

To get fast feedback locally and block bad pushes before CI.

Repo

👉 GitHub link here


PyStrict Development Log: Journey to Maximum Strictness

Week 1 (6 weeks ago) - Foundation

Day 1: Initial Commit

7d01a2b - first commit

Started with the core concept: Python strictness equivalent to TypeScript's --strict mode.

Day 1-2: Type Checking Evolution

2393d49 - feat: migrate from pyright to basedpyright with stricter error-level checking
  • Migrated from pyright to basedpyright for enhanced strictness

  • Enabled error-level checking instead of warnings

  • Target: eliminate all implicit Any types

Day 2: Documentation & Standards

84eb424 - docs: add comprehensive README with template usage instructions
accd12e - fix: rename pyproyect.toml to pyproject.toml
  • Established project philosophy: production-grade quality from day one

  • Fixed typo in config filename (early iteration pain 😅)

  • Documented the "ultra-strict" approach

Day 3: Tooling Refinement

1ab6a8a - style: normalize indentation in dev dependencies
ba7448b - feat: add BLE rule and optional Pandera configuration
  • Added BLE (flake8-blind-except) rule - no more bare except: blocks

  • Introduced Pandera for DataFrame schema validation (optional)

  • Normalized tooling configuration for consistency

Day 4: Dead Code Detection

fe34b82 - chore: add .gitignore and uv.lock for dependency management
e7bd14b - refactor: replace vulture with skylos for dead code detection
  • Swapped vulture for skylos - better accuracy, fewer false positives

  • Locked dependencies with uv.lock for reproducible builds

Week 2 (6 weeks ago) - Anti-Slop Measures

62ff0bd - feat: add comprehensive anti-LLM-slop rules and documentation

Major milestone: Implemented systematic defenses against AI-generated code bloat:

  • Max cyclomatic complexity: 10

  • Max nested blocks: 3

  • Mandatory Pydantic models for all I/O

  • Boolean trap detection (FBT rules)

  • Comprehensive documentation on avoiding over-engineering

This became PyStrict's signature feature - actively fighting verbose, over-commented LLM output.

Week 3 (6 weeks ago) - Workflow Optimization

8190f81 - feat: reorder quality checks to run radon before skylos
1d34ce4 - feat: treat pytest warnings as errors to catch deprecations early
  • Optimized quality check order: complexity analysis → dead code detection

  • Made pytest warnings fatal - catch deprecations before they break production

  • Philosophy: fail fast, fail early, fix immediately

Week 6 (3 weeks ago) - Automation Phase

d4195e8 - feat: add pre-commit to dev dependencies
f872295 - feat: update ruff pre-commit hook to v0.14.8 and add setup instructions
  • Integrated pre-commit hooks for automated quality gates

  • Updated to latest Ruff version (v0.14.8)

  • Added comprehensive setup documentation for new contributors

Week 7 (1 week ago) - Runtime Validation

ca73a67 - feat: add ty for runtime type checking to quality workflow
  • Added ty for runtime type validation

  • Bridge the gap: static type checking (basedpyright) + runtime validation (ty)

  • Catch type errors in production, not just in IDE

27/12/25 - Performance Revolution

[current] - feat: migrate from pre-commit to prek for 3x faster execution

The Problem: Running 7+ quality tools (ruff, basedpyright, skylos, radon, ty, pytest) on every commit was getting slow.

The Solution: Migrated to prek - Rust-based pre-commit alternative.

Technical Changes:

  • pyproject.toml: Replaced pre-commit dependency with prek==0.2.25

  • .pre-commit-config.yaml: Updated autoupdate command reference

  • README.md: Updated all installation and usage commands

Performance Gains:

  • 3x faster hook execution via parallel processing

  • 50% less disk space with shared toolchain management

  • Native uv integration (we were already using uv)

  • Zero config changes - 100% backward compatible

Why It Matters: With PyStrict's aggressive quality checks, every commit triggers:

  1. Ruff format

  2. Ruff lint (commit)

  3. Ruff lint (push)

  4. basedpyright type check

  5. Radon complexity analysis

  6. Skylos dead code detection

  7. ty runtime validation

  8. pytest with 80% coverage requirement

Prek's priority-based parallel execution turns sequential pain into concurrent speed.


Architecture Evolution

Week 1: Foundation (Type safety + Linting)
Week 2: Anti-Slop (Complexity limits + Best practices)
Week 3: Workflow (Automation + CI/CD readiness)
Week 7: Runtime (Bridge static/dynamic checking)
Today:  Performance (Parallel execution + Native tooling)

Key Metrics

  • Strictness level: TypeScript --strict equivalent

  • Quality tools: 7 integrated tools

  • Coverage requirement: 80% minimum

  • Hook execution: 3x faster with prek

  • Configuration: Single pyproject.toml source of truth

Philosophy

Every change follows one principle: Make bad code impossible to write, not just discouraged.

The prek migration maintains this - faster feedback loops mean developers catch issues sooner, making the strict workflow actually pleasant to use.

🌐
Potapov
potapov.me › home › blog › ty from astral: the type checker that rewrites the rules
ty from Astral: Revolution in Python Type Checking — Potapov.me
December 24, 2025 - # CI: ty (fast) ty check # Pre-commit: ty (doesn't slow development) ty check --files-changed # For complex cases: mypy (fallback) mypy specific_file.py --strict
🌐
Reddit
reddit.com › r/python › update: copier-astral now uses prek (faster pre-commit) + bug fixes from your feedback
r/Python on Reddit: Update: copier-astral now uses prek (faster pre-commit) + bug fixes from your feedback
February 14, 2026 -

Two weeks ago I shared copier-astral here and the response was incredible — thank you! The feedback helped me find and fix real bugs.

What's new since last post:

  • Fixed github_username not being set during installation

  • Fixed uv tool inject bug

  • Fixed missing ty dependency in generated projects

  • Replaced pre-commit with prek — a faster Rust-based alternative

  • Added pysentry-rs and semgrep to scan for potential vulnerabilities

  • Now at 100+ stars

Quick reminder — what it does:

Scaffolds a complete Python project with modern tooling pre-configured:

  • ruff for linting + formatting (replaces black, isort, flake8)

  • ty for type checking (Astral's new Rust-based type checker)

  • pytest + hatch for testing (including multi-version matrix)

  • MkDocs with Material theme + mkdocstrings

  • pre-commit hooks with prek

  • GitHub Actions CI/CD

  • Docker support

  • Typer CLI scaffold (optional)

  • git-cliff for auto-generated changelogs

Looking for contributors:

3 open issues if anyone wants to help out: https://github.com/ritwiktiwari/copier-astral/issues

Thanks again — happy to answer any questions!

Links:

  • GitHub: https://github.com/ritwiktiwari/copier-astral

  • Docs: https://ritwiktiwari.github.io/copier-astral/

  • Reddit: Previous Post