Synthèse automatique
Ce skill documente l'utilisation de ty, le vérificateur de types Python et serveur de langage d'Astral, de l'installation à la configuration des règles et à l'intégration éditeur.
Points forts
- Fournit des commandes concrètes pour uv, pipx, pip et uvx, avec vérification de version et mise à jour.
- Détaille la configuration dans pyproject.toml ou ty.toml, y compris les niveaux de règles, les overrides par glob et la résolution de l'environnement Python.
- Couvre les usages courants : vérification ciblée, mode watch, exécution en CI et diagnostic des imports non résolus.
Limites
- ty est en beta 0.0.x : les diagnostics et le comportement peuvent changer entre versions, ce qui impose d'épingler la version.
- L'extrait fourni s'arrête au milieu d'un exemple de suppression de diagnostic, donc la procédure complète d'ignore n'est pas visible.
- La migration depuis mypy ou pyright est annoncée dans la description mais très peu détaillée dans le contenu visible.
Utilisez ce skill lorsque vous devez vérifier les types d'un projet Python avec ty, ajuster ses règles dans pyproject.toml ou la CI, ou l'installer comme serveur de langage dans un éditeur.
Évitez-le si vous cherchez un vérificateur de types stable pour la production ou un guide complet de migration pas à pas depuis mypy ou pyright.
Analyse de sécurité
SûrThe skill is pure documentation for running a type checker. All commands shown are read-only analysis or standard package installs through uv/pipx/pip; there is no obfuscation, no credential or token handling, no data exfiltration, and no destructive filesystem operations. `--add-ignore` only writes comments into the user's own source files and the skill explicitly instructs reviewing the diff first. It even advises against piping installers into a shell. The text contains no embedded instructions attempting to redirect the auditor.
Aucun point d'attention détecté
Comment cette analyse est faiteExemples
Add ty as a dev dependency with uv, configure [tool.ty] in pyproject.toml for Python 3.12, and run ty check on src/ and tests/.Set up a CI job that installs ty with uv and fails on type errors, while ignoring invalid-assignment in tests/.Show me how to configure ty as the Python language server in Neovim and VS Code for my project.name: ty description: >- Checks Python code for type errors with ty, Astral's fast type checker and language server written in Rust. Use when a user asks to type check a Python project, add ty to pyproject.toml or CI, silence or baseline existing type errors, set up a type-checking language server in VS Code, Neovim, Zed or PyCharm, or move from mypy or pyright. Covers ty check, configuration, rule levels, ignore comments and output formats. license: Apache-2.0 compatibility: "Python projects targeting 3.10+ (older targets work with less accurate stdlib stubs). Install with uv, pipx or pip; the standalone binary needs no Python. ty is in beta (0.0.x versioning)." metadata: author: terminal-skills version: "1.0.0" category: development tags: "python, type-checking, language-server, astral, static-analysis" repository: https://github.com/astral-sh/ty
ty — fast Python type checker and language server
Overview
ty is a static type checker for Python and a language server, made by Astral (the authors of uv and Ruff). The command line reports type errors such as calling a method on a value that may be None, or assigning an int to a str variable. The same binary runs as a language server for editors.
ty uses 0.0.x versions. Its own README warns that diagnostics and behavior can change between any two releases, so pin the version in projects and CI. The commands below were run against ty 0.0.91.
Instructions
Install
Prefer a project dependency so every developer and CI job uses the same version:
uv add --dev ty # project dev dependency, run with: uv run ty check
uv tool install ty@latest # global tool
pipx install ty # global, without uv
pip install ty # into the active environment
uvx ty check # one-off run, nothing installed
Check the install with ty --version. Upgrading: uv lock --upgrade-package ty, uv tool upgrade ty or pipx upgrade ty.
Run a check
ty check # whole project, from the current directory
ty check src tests/test_cart.py # specific files or directories
ty check --project services/billing # run for a project in a subdirectory
ty check --watch # re-check when files change
Exit code is 1 when there are errors and 0 when clean. Warnings do not fail the run unless --error-on-warning is set.
ty needs to see the project's virtual environment to resolve third-party imports. It finds .venv (and an activated environment) by itself. For any other location, pass it:
ty check --python /srv/venvs/billing # a venv directory or interpreter
ty check --python-version 3.12 # target version for syntax and stdlib types
ty check --extra-search-path vendor/ # extra module roots
If ty reports unresolved-import for packages that are installed, the environment was not found: pass --python.
Configure
Put settings in pyproject.toml under [tool.ty], or in a ty.toml file (same keys without the tool. prefix). Command-line options win over files.
[tool.ty.environment]
python-version = "3.12"
root = ["./src"]
[tool.ty.src]
exclude = ["build/", "migrations/"]
[tool.ty.rules]
possibly-missing-attribute = "warn"
unused-ignore-comment = "warn"
[[tool.ty.overrides]]
include = ["tests/**"]
[tool.ty.overrides.rules]
invalid-assignment = "ignore"
environment.python-version: if absent, ty readsproject.requires-python, then the environment's Python.rules: each rule is"error","warn"or"ignore". List names and defaults withty explain ruleand read one withty explain rule invalid-assignment.overrides: change rules for file globs, for example looser rules in tests.- One-off rule level on the command line:
ty check --error possibly-missing-attribute --ignore unused-ignore-comment.
Suppress diagnostics
Add a comment on the offending line, naming the rule:
price = find(items, "A1").price_cents # ty: ignore[unresolved-attribute]
To baseline a legacy code base, let ty write the comments for every current error, then review the diff:
ty check --add-ignore
After that ty check passes, and new errors fail. Enable unused-ignore-comment = "warn" so stale ignores are reported once the code is fixed. # type: ignore comments are also honored.
Output formats for CI
ty check --output-format concise # one line per diagnostic
ty check --output-format github # GitHub Actions annotations
ty check --output-format gitlab # GitLab Code Quality JSON
ty check --output-format junit # JUnit XML
ty check --exit-zero # report only, never fail (for a trial period)
A GitHub Actions step, using uv:
- uses: astral-sh/setup-uv@v6
- run: uv sync --dev
- run: uv run ty check --output-format github
Editor integration
The language server is ty server; editors start it themselves.
- VS Code: install the official ty extension from the Marketplace. It turns off the Python extension's own language server (
python.languageServer = "None"). To use ty only for diagnostics next to Pylance, set"python.languageServer": "Pylance"and"ty.disableLanguageServices": true. - Neovim 0.11+:
vim.lsp.enable('ty')(config from nvim-lspconfig). Optional settings go throughvim.lsp.config('ty', { settings = { ty = {} } }). - Zed: ty is built in; list
"ty"and"ruff"underlanguages.Python.language_serversto use it instead of basedpyright. - PyCharm 2025.3+: Settings, Python, Tools, ty, tick Enable.
- Emacs 29+ with Eglot: map
python-base-modeto("ty" "server"). - Any other LSP client: run
ty serverover stdio.
Coming from mypy or pyright
ty is gradual: unannotated code is treated leniently, so a first run on an untyped code base is usually quieter than strict mypy. It reads pyproject.toml itself and does not read mypy.ini, [tool.mypy] or pyrightconfig.json, so rules must be re-expressed in [tool.ty]. Its documentation has a "Coming from mypy, pyright" page and a typing FAQ; consult them when a diagnostic differs from the old tool, since ty's type system is still being completed. Run the old checker and ty side by side until the diagnostics you care about agree.
Examples
Example 1: first run on a small shop service
Request: "Type check the cart module and tell me what is wrong."
src/shop/cart.py ends with:
price = find([Item("A1", 500)], "A1").price_cents
label: str = total([Item("A1", 500)])
where find returns Item | None and total returns int. Command:
ty check --output-format concise
Result:
src/shop/cart.py:21:9: error[unresolved-attribute] Attribute `price_cents` is not defined on `None` in union `Item | None`
src/shop/cart.py:22:14: error[invalid-assignment] Object of type `int` is not assignable to `str`
Found 2 diagnostics
The agent fixes the first by handling None (item = find(...), if item is None: raise LookupError(...)) and the second by changing the annotation to int, then reruns ty check until it prints All checks passed!.
Example 2: adopt ty on a legacy service without a big-bang fix
Request: "Add ty to billing-service CI but do not block every PR on 300 old errors."
cd billing-service
uv add --dev ty
uv run ty check --exit-zero --output-format concise | tail -1 # Found 312 diagnostics
uv run ty check --add-ignore # Added 312 ignore comments
uv run ty check # All checks passed!
git diff --stat
Then the agent adds [tool.ty.rules] unused-ignore-comment = "warn" to pyproject.toml, adds the CI step from the section above, and opens a pull request that lists the ignore comments as technical debt to burn down by rule, for example grep -rn "ty: ignore\[invalid-argument-type\]" src | wc -l.
Guidelines
- Pin ty in the project (
uv add --dev ty) and read release notes when upgrading: new versions can add or change diagnostics. - Treat ty as a beta tool. If it disagrees with a mature checker on a construct, check the typing FAQ before rewriting code, and do not put its output on a required check until the team accepts that.
- Never fix a diagnostic by adding
# ty: ignorewithout reading it. Use--add-ignoreonly deliberately, for a baseline, and review the diff. - Third-party imports unresolved? The cause is nearly always a missing
--pythonor an environment that is not installed, not a ty bug. ty checkreads files only; it does not run your code or tests.- Do not pipe an installer into a shell. If the standalone installer is needed, download it from astral.sh to a file, read it, then run it.
- Do not use it for non-Python code, and it does not replace a linter or formatter: use Ruff for those.
Du fichier au premier essai
Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.
Consulter la source et ses fichiers annexesCe téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.
1. Télécharger le fichier
Télécharger SKILL.mdDepuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/python-type-checking-with-ty-mwirmdxx/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.
Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.
mkdir -p '.skill-downloads/python-type-checking-with-ty-mwirmdxx' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/python-type-checking-with-ty-mwirmdxx/download' --output '.skill-downloads/python-type-checking-with-ty-mwirmdxx/SKILL.md.part' && mv '.skill-downloads/python-type-checking-with-ty-mwirmdxx/SKILL.md.part' '.skill-downloads/python-type-checking-with-ty-mwirmdxx/SKILL.md'2. Vérifier les prérequis
Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.
Environnement déclaré par l’auteur : Python projects targeting 3.10+ (older targets work with less accurate stdlib stubs). Install with uv, pipx or pip; the standalone binary needs no Python. ty is in beta (0.0.x versioning).
Aucune section de prérequis reconnue dans ce fichier. Cela ne signifie pas qu’il est autonome : les bibliothèques, outils et accès peuvent être cités ailleurs dans le contenu ou dans le dépôt source.
Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.
3. Charger la skill
Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.
Claude Code
test -f '.skill-downloads/python-type-checking-with-ty-mwirmdxx/SKILL.md' && test -s '.skill-downloads/python-type-checking-with-ty-mwirmdxx/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/ty' && cp -R '.skill-downloads/python-type-checking-with-ty-mwirmdxx' '.claude/skills/ty'Cursor
test -f '.skill-downloads/python-type-checking-with-ty-mwirmdxx/SKILL.md' && test -s '.skill-downloads/python-type-checking-with-ty-mwirmdxx/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/ty' && cp -R '.skill-downloads/python-type-checking-with-ty-mwirmdxx' '.cursor/skills/ty'Codex
test -f '.skill-downloads/python-type-checking-with-ty-mwirmdxx/SKILL.md' && test -s '.skill-downloads/python-type-checking-with-ty-mwirmdxx/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/ty' && cp -R '.skill-downloads/python-type-checking-with-ty-mwirmdxx' '.agents/skills/ty'OpenSkills
OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.
Installation officielle d’OpenSkillsopenskills install './.skill-downloads/python-type-checking-with-ty-mwirmdxx'openskills read 'python-type-checking-with-ty-mwirmdxx'La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.
Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.
openskills syncMode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.
4. Faire un premier essai
Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :
Lis .skill-downloads/python-type-checking-with-ty-mwirmdxx/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.
Bonnes pratiques React Hook Form
Developpement
Maîtrisez React Hook Form : évitez les anti-patterns, gérez les abonnements, et traitez correctement reset, dirty state et entrées contrôlées.
Migration Emotion vers Mantine
Developpement
Migrer les styled-components Emotion vers des composants Mantine avec style props et modules CSS. Pour convertir .styled.tsx ou supprimer les imports @emotion.
Détecteur de dérive de périmètre
Developpement
Analyse les diffs git par rapport à une intention pour détecter la dérive de périmètre, fichiers non liés et PR trop larges, puis suggère de garder, diviser ou justifier.