skillfed

tyro

CLI interfaces & config objects, from types

tyro v1.0.15 14.7M downloads/30d#1,217 on PyPI1,098
Permissive license MIT Active released

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 tyro

uv

uv add tyro

poetry

poetry add tyro

Installing 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

License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

cli from type annotationsauto generate command line interfacedataclass to clipydantic config clipython argparse alternativetyped config parsercli builder from types
cli-generationtype-drivenconfiguration-management

More Software Development packages