tyro
CLI interfaces & config objects, from types
What it is and what it does
tyro is a library that turns Python type annotations into command-line interfaces and configuration objects without requiring separate schema definitions or configuration files. You write a function or dataclass with type hints and docstrings, and tyro automatically generates a CLI with argument parsing, help text, type validation, and nested subcommand support. It integrates with popular configuration libraries like dataclasses, attrs, and Pydantic, making it useful for both throwaway scripts and larger projects that need maintainable, type-safe configuration.
The library is designed around the principle that your code's type annotations and docstrings should be the single source of truth for CLI behavior. This approach keeps configuration logic close to where it's used and enables static type checkers to understand your CLI arguments, improving IDE support and catching errors at development time rather than runtime.
Use it for:
- Build CLI tools for machine learning experiments where hyperparameters are defined as dataclass fields with type hints.
- Generate configuration interfaces for research codebases without writing separate argument parsing logic.
- Create nested command structures for tools that need hierarchical configuration and subcommands.
- Rapidly prototype scripts that accept typed arguments while maintaining IDE autocomplete and type checking.
- Integrate configuration models directly into CLI applications with automatic validation and help text generation.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
tyro generates command-line interfaces and configuration objects directly from Python type annotations, docstrings, and default values, supporting dataclasses, Pydantic models, and attrs.
Yes. tyro is actively maintained, has no known vulnerabilities, installs with low friction, and solves a real problem—turning type annotations into CLIs—in a way that integrates well with modern Python tooling and type checkers. It's particularly valuable if you're already using dataclasses, attrs, or Pydantic and want to avoid writing boilerplate argument parsing code.
Install
tyro on PyPI
pip
pip install tyrouv
uv add tyropoetry
poetry add tyroInstalling tyro
Before you install
Low friction: pure Python wheel with four runtime dependencies (docstring-parser, eval-type-backport, typeguard, typing-extensions). Actively maintained with a recent release (55 days ago) and 1098 repository stars.
License in practice
MIT license (permissive) means you can use, modify, and distribute tyro freely in commercial and private projects with minimal restrictions.
Quickstart
pip install tyro
import tyro
from dataclasses import dataclass
@dataclass
class Config:
name: str
count: int
config = tyro.cli(Config)
Requires Python 3.8 or later.
Verify before relying
- Whether shell completion works across all major shells (bash, zsh, fish, PowerShell).
- Performance characteristics when handling deeply nested configuration hierarchies.
- Compatibility with custom type annotations beyond standard library types.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — docstring-parser, eval-type-backport, typeguard, typing-extensions |
| Maintenance | actively maintained — 55 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 14,734,015/month — #1,217 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: tyro-1.0.15-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
fireAutomatically generates command-line interfaces…
permissive · top 5,000 on PyPI
jsonargparsejsonargparse creates command-line interfaces…
permissive · top 5,000 on PyPI
targGenerates a command-line interface from…
permissive · top 15,000 on PyPI
simple-parsingTransforms argparse scripts into structured,…
permissive · top 5,000 on PyPI
argparse-dataclassBuilds command-line interfaces declaratively by…
permissive · top 5,000 on PyPI
cycloptsCyclopts is a CLI framework that converts…
permissive · top 1,000 on PyPI
clizeClize turns Python functions into command-line…
permissive · top 15,000 on PyPI
pydantic-argparseGenerates command-line argument parsers from…
permissive · top 5,000 on PyPI
argdanticBuilds typed command-line interfaces by…
permissive · top 15,000 on PyPI
py-avro-schemaGenerates Apache Avro schemas from Python…
permissive · top 15,000 on PyPI