Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ jobs:
run: uv run ruff format --check src tests
- name: Run mypy
run: uv run mypy
- name: Run ty
run: uv run ty check
- name: Run bandit
run: uv run bandit -r src
- name: Test with pytest
Expand Down
13 changes: 12 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ci:
skip: [pytest]
skip: [pytest, ty]

default_language_version:
python: python3.14
Expand Down Expand Up @@ -30,6 +30,17 @@ repos:
- id: mypy
name: mypy

# ty - lint-like type checking (Astral, preview)
- repo: local
hooks:
- id: ty
name: ty
entry: uv run ty check
language: system
types: [python]
pass_filenames: false
require_serial: true

# bandit - find common security issues
- repo: https://github.com/pycqa/bandit
rev: 1.9.4
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ Rules are defined in the [`pyproject.toml`](pyproject.toml).

For more configuration options and details, see the [configuration docs](https://mypy.readthedocs.io/).

### ty

[ty](https://github.com/astral-sh/ty) is a fast type checker from Astral, written in Rust. It runs alongside mypy as a second blocking type-checker.

Rules are defined in the [`pyproject.toml`](pyproject.toml).

For more configuration options and details, see the [ty documentation](https://github.com/astral-sh/ty).

### bandit

[bandit](https://bandit.readthedocs.io/) is a tool designed to find common security issues in Python code.
Expand Down
33 changes: 33 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ dev = [
"mypy>=1.20.2",
"bandit>=1.9.4",
"ruff>=0.15.12",
"ty>=0.0.35",
]

[tool.uv]
Expand Down Expand Up @@ -115,3 +116,35 @@ convention = "pep257"
[tool.mypy]
files = ["src", "tests"]
strict = "true"

[tool.ty.src]
include = ["src", "tests"]

[tool.ty.rules]
# strict profile: every diagnostic ty exposes at "error" severity
# Each rule whose default severity is "warn" or "ignore" is promoted to "error".
ambiguous-protocol-member = "error"
deprecated = "error"
ignore-comment-unknown-rule = "error"
ineffective-final = "error"
invalid-enum-member-annotation = "error"
invalid-ignore-comment = "error"
invalid-legacy-positional-parameter = "error"
invalid-named-tuple-override = "error"
mismatched-type-name = "error"
possibly-missing-implicit-call = "error"
possibly-missing-submodule = "error"
redundant-cast = "error"
redundant-final-classvar = "error"
undefined-reveal = "error"
unresolved-global = "error"
unsupported-base = "error"
unused-awaitable = "error"
unused-ignore-comment = "error"
unused-type-ignore-comment = "error"
useless-overload-body = "error"
division-by-zero = "error"
possibly-missing-attribute = "error"
possibly-missing-import = "error"
possibly-unresolved-reference = "error"
unsupported-dynamic-base = "error"
27 changes: 27 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.