tyro


Nametyro JSON
Version 0.8.3 PyPI version JSON
download
home_pageNone
SummaryStrongly typed, zero-effort CLI interfaces
upload_time2024-04-09 19:25:32
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <br />
<p align="center">
    <!--
    Note that this README will be used for both GitHub and PyPI.
    We therefore:
    - Keep all image URLs absolute.
    - In the GitHub action we use for publishing, strip some HTML tags that aren't supported by PyPI.
    -->
        <img alt="tyro logo" src="https://brentyi.github.io/tyro/_static/logo-light.svg" width="200px" />

</p>

<p align="center">
    <em><a href="https://brentyi.github.io/tyro">Documentation</a></em>
    &nbsp;&nbsp;&bull;&nbsp;&nbsp;
    <em><code>pip install tyro</code></em>
</p>

<p align="center">
    <img alt="build" src="https://github.com/brentyi/tyro/actions/workflows/build.yml/badge.svg" />
    <img alt="mypy" src="https://github.com/brentyi/tyro/actions/workflows/mypy.yml/badge.svg" />
    <img alt="pyright" src="https://github.com/brentyi/tyro/actions/workflows/pyright.yml/badge.svg" />
    <img alt="ruff" src="https://github.com/brentyi/tyro/actions/workflows/ruff.yml/badge.svg" />
    <a href="https://codecov.io/gh/brentyi/tyro">
        <img alt="codecov" src="https://codecov.io/gh/brentyi/tyro/branch/main/graph/badge.svg" />
    </a>
    <a href="https://pypi.org/project/tyro/">
        <img alt="codecov" src="https://img.shields.io/pypi/pyversions/tyro" />
    </a>
</p>

<br />

<strong><code>tyro</code></strong> is a tool for generating command-line
interfaces and configuration objects in Python.

Our core API, `tyro.cli()`,

- **Generates CLI interfaces** from Python type signatures.
- **Populates helptext automatically** from defaults, annotations, and
  docstrings.
- **Understands nesting** of `dataclasses`, `pydantic`, and `attrs` structures.
- **Prioritizes static analysis** for type checking and autocompletion with
  tools like
  [Pylance](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance),
  [Pyright](https://github.com/microsoft/pyright), and
  [mypy](https://github.com/python/mypy).

For advanced users, it also supports:

- **Subcommands**, as well as choosing between and overriding values in
  configuration objects.
- **Completion script generation** for `bash`, `zsh`, and `tcsh`.
- **Fine-grained configuration** via PEP 529 runtime annotations
  (`tyro.conf.*`).

For examples and the API reference, see our
[documentation](https://brentyi.github.io/tyro).

### In the wild

`tyro` is designed to be lightweight enough for throwaway scripts, while
facilitating type safety and modularity for larger projects. Examples:

<table>
  <tr>
    <td>
      <a href="https://github.com/nerfstudio-project/nerfstudio/">
        nerfstudio-project/nerfstudio
        <br /><img
          alt="GitHub star count"
          src="https://img.shields.io/github/stars/nerfstudio-project/nerfstudio?style=social"
        />
      </a>
    </td>
    <td>
      Open-source tools for neural radiance fields.
    </td>
  </tr>
  <tr>
    <td>
      <a href="https://github.com/Sea-Snell/JAXSeq/">
        Sea-Snell/JAXSeq
        <br /><img
          alt="GitHub star count"
          src="https://img.shields.io/github/stars/Sea-Snell/JAXSeq?style=social"
        />
      </a>
    </td>
    <td>Library for distributed training of large language models in JAX.</td>
  </tr>
  <tr>
    <td>
      <a href="https://github.com/kevinzakka/obj2mjcf">
        kevinzakka/obj2mjcf
        <br /><img
          alt="GitHub star count"
          src="https://img.shields.io/github/stars/kevinzakka/obj2mjcf?style=social"
        />
      </a>
    </td>
    <td>Interface for processing composite Wavefront OBJ files for Mujoco.</td>
  </tr>
  <tr>
    <td>
      <a href="https://github.com/blurgyy/jaxngp">
        blurgyy/jaxngp
        <br /><img
          alt="GitHub star count"
          src="https://img.shields.io/github/stars/blurgyy/jaxngp?style=social"
        />
      </a>
    </td>
    <td>
      CUDA-accelerated implementation of
      <a href="https://nvlabs.github.io/instant-ngp/">instant-ngp</a>, in JAX.
    </td>
  </tr>
  <tr>
    <td>
      <a href="https://github.com/NVIDIAGameWorks/kaolin-wisp">
        NVIDIAGameWorks/kaolin-wisp
        <br /><img
          alt="GitHub star count"
          src="https://img.shields.io/github/stars/NVIDIAGameWorks/kaolin-wisp?style=social"
        />
      </a>
    </td>
    <td>PyTorch library for neural fields.</td>
  </tr>
  <tr>
    <td>
      <a href="https://github.com/autonomousvision/sdfstudio">
        autonomousvision/sdfstudio
        <br /><img
          alt="GitHub star count"
          src="https://img.shields.io/github/stars/autonomousvision/sdfstudio?style=social"
        />
      </a>
    </td>
    <td>Unified framework for surface reconstruction.</td>
  </tr>
  <tr>
    <td>
      <a href="https://github.com/openrlbenchmark/openrlbenchmark">
        openrlbenchmark/openrlbenchmark
        <br /><img
          alt="GitHub star count"
          src="https://img.shields.io/github/stars/openrlbenchmark/openrlbenchmark?style=social"
        />
      </a>
    </td>
    <td>Collection of tracked experiments for reinforcement learning.</td>
  </tr>
</table>

### Alternatives

`tyro` bakes many opinions into its design decisions. If any of them don't make
sense, feel free to file an issue!

You might also consider one of many alternative libraries. Some that we
particularly like:

- [simple-parsing](https://github.com/lebrice/SimpleParsing) and
  [jsonargparse](https://github.com/omni-us/jsonargparse), which provide deeper
  integration with configuration file formats like YAML and JSON.
- [clipstick](https://github.com/sander76/clipstick), which focuses on
  generating CLIs from Pydantic models.
- [datargs](https://github.com/roee30/datargs), which provides a minimal API for
  dataclasses.
- [fire](https://github.com/google/python-fire) and
  [clize](https://github.com/epsy/clize), which support arguments without type
  annotations.

We also have some notes on `tyro`'s design goals and other alternatives in the
docs [here](https://brentyi.github.io/tyro/goals_and_alternatives/).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "tyro",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "brentyi <brentyi@berkeley.edu>",
    "download_url": "https://files.pythonhosted.org/packages/16/73/b1d81353d7d104d13da8d8d657f436ae5141a9fe253983bac7883c573e59/tyro-0.8.3.tar.gz",
    "platform": null,
    "description": "<br />\n<p align=\"center\">\n    <!--\n    Note that this README will be used for both GitHub and PyPI.\n    We therefore:\n    - Keep all image URLs absolute.\n    - In the GitHub action we use for publishing, strip some HTML tags that aren't supported by PyPI.\n    -->\n        <img alt=\"tyro logo\" src=\"https://brentyi.github.io/tyro/_static/logo-light.svg\" width=\"200px\" />\n\n</p>\n\n<p align=\"center\">\n    <em><a href=\"https://brentyi.github.io/tyro\">Documentation</a></em>\n    &nbsp;&nbsp;&bull;&nbsp;&nbsp;\n    <em><code>pip install tyro</code></em>\n</p>\n\n<p align=\"center\">\n    <img alt=\"build\" src=\"https://github.com/brentyi/tyro/actions/workflows/build.yml/badge.svg\" />\n    <img alt=\"mypy\" src=\"https://github.com/brentyi/tyro/actions/workflows/mypy.yml/badge.svg\" />\n    <img alt=\"pyright\" src=\"https://github.com/brentyi/tyro/actions/workflows/pyright.yml/badge.svg\" />\n    <img alt=\"ruff\" src=\"https://github.com/brentyi/tyro/actions/workflows/ruff.yml/badge.svg\" />\n    <a href=\"https://codecov.io/gh/brentyi/tyro\">\n        <img alt=\"codecov\" src=\"https://codecov.io/gh/brentyi/tyro/branch/main/graph/badge.svg\" />\n    </a>\n    <a href=\"https://pypi.org/project/tyro/\">\n        <img alt=\"codecov\" src=\"https://img.shields.io/pypi/pyversions/tyro\" />\n    </a>\n</p>\n\n<br />\n\n<strong><code>tyro</code></strong> is a tool for generating command-line\ninterfaces and configuration objects in Python.\n\nOur core API, `tyro.cli()`,\n\n- **Generates CLI interfaces** from Python type signatures.\n- **Populates helptext automatically** from defaults, annotations, and\n  docstrings.\n- **Understands nesting** of `dataclasses`, `pydantic`, and `attrs` structures.\n- **Prioritizes static analysis** for type checking and autocompletion with\n  tools like\n  [Pylance](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance),\n  [Pyright](https://github.com/microsoft/pyright), and\n  [mypy](https://github.com/python/mypy).\n\nFor advanced users, it also supports:\n\n- **Subcommands**, as well as choosing between and overriding values in\n  configuration objects.\n- **Completion script generation** for `bash`, `zsh`, and `tcsh`.\n- **Fine-grained configuration** via PEP 529 runtime annotations\n  (`tyro.conf.*`).\n\nFor examples and the API reference, see our\n[documentation](https://brentyi.github.io/tyro).\n\n### In the wild\n\n`tyro` is designed to be lightweight enough for throwaway scripts, while\nfacilitating type safety and modularity for larger projects. Examples:\n\n<table>\n  <tr>\n    <td>\n      <a href=\"https://github.com/nerfstudio-project/nerfstudio/\">\n        nerfstudio-project/nerfstudio\n        <br /><img\n          alt=\"GitHub star count\"\n          src=\"https://img.shields.io/github/stars/nerfstudio-project/nerfstudio?style=social\"\n        />\n      </a>\n    </td>\n    <td>\n      Open-source tools for neural radiance fields.\n    </td>\n  </tr>\n  <tr>\n    <td>\n      <a href=\"https://github.com/Sea-Snell/JAXSeq/\">\n        Sea-Snell/JAXSeq\n        <br /><img\n          alt=\"GitHub star count\"\n          src=\"https://img.shields.io/github/stars/Sea-Snell/JAXSeq?style=social\"\n        />\n      </a>\n    </td>\n    <td>Library for distributed training of large language models in JAX.</td>\n  </tr>\n  <tr>\n    <td>\n      <a href=\"https://github.com/kevinzakka/obj2mjcf\">\n        kevinzakka/obj2mjcf\n        <br /><img\n          alt=\"GitHub star count\"\n          src=\"https://img.shields.io/github/stars/kevinzakka/obj2mjcf?style=social\"\n        />\n      </a>\n    </td>\n    <td>Interface for processing composite Wavefront OBJ files for Mujoco.</td>\n  </tr>\n  <tr>\n    <td>\n      <a href=\"https://github.com/blurgyy/jaxngp\">\n        blurgyy/jaxngp\n        <br /><img\n          alt=\"GitHub star count\"\n          src=\"https://img.shields.io/github/stars/blurgyy/jaxngp?style=social\"\n        />\n      </a>\n    </td>\n    <td>\n      CUDA-accelerated implementation of\n      <a href=\"https://nvlabs.github.io/instant-ngp/\">instant-ngp</a>, in JAX.\n    </td>\n  </tr>\n  <tr>\n    <td>\n      <a href=\"https://github.com/NVIDIAGameWorks/kaolin-wisp\">\n        NVIDIAGameWorks/kaolin-wisp\n        <br /><img\n          alt=\"GitHub star count\"\n          src=\"https://img.shields.io/github/stars/NVIDIAGameWorks/kaolin-wisp?style=social\"\n        />\n      </a>\n    </td>\n    <td>PyTorch library for neural fields.</td>\n  </tr>\n  <tr>\n    <td>\n      <a href=\"https://github.com/autonomousvision/sdfstudio\">\n        autonomousvision/sdfstudio\n        <br /><img\n          alt=\"GitHub star count\"\n          src=\"https://img.shields.io/github/stars/autonomousvision/sdfstudio?style=social\"\n        />\n      </a>\n    </td>\n    <td>Unified framework for surface reconstruction.</td>\n  </tr>\n  <tr>\n    <td>\n      <a href=\"https://github.com/openrlbenchmark/openrlbenchmark\">\n        openrlbenchmark/openrlbenchmark\n        <br /><img\n          alt=\"GitHub star count\"\n          src=\"https://img.shields.io/github/stars/openrlbenchmark/openrlbenchmark?style=social\"\n        />\n      </a>\n    </td>\n    <td>Collection of tracked experiments for reinforcement learning.</td>\n  </tr>\n</table>\n\n### Alternatives\n\n`tyro` bakes many opinions into its design decisions. If any of them don't make\nsense, feel free to file an issue!\n\nYou might also consider one of many alternative libraries. Some that we\nparticularly like:\n\n- [simple-parsing](https://github.com/lebrice/SimpleParsing) and\n  [jsonargparse](https://github.com/omni-us/jsonargparse), which provide deeper\n  integration with configuration file formats like YAML and JSON.\n- [clipstick](https://github.com/sander76/clipstick), which focuses on\n  generating CLIs from Pydantic models.\n- [datargs](https://github.com/roee30/datargs), which provides a minimal API for\n  dataclasses.\n- [fire](https://github.com/google/python-fire) and\n  [clize](https://github.com/epsy/clize), which support arguments without type\n  annotations.\n\nWe also have some notes on `tyro`'s design goals and other alternatives in the\ndocs [here](https://brentyi.github.io/tyro/goals_and_alternatives/).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Strongly typed, zero-effort CLI interfaces",
    "version": "0.8.3",
    "project_urls": {
        "GitHub": "https://github.com/brentyi/tyro"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8af60b3dca524fdba07dff7b1a029e5546212440e7d2ebd60fc5fc3f4c5d0fbc",
                "md5": "defa6e3ed45aee2050b71429020cf9ac",
                "sha256": "11c657c974e7f5db1ef0659b86c5823850f148b41cc5adf4a7affc835dd551a6"
            },
            "downloads": -1,
            "filename": "tyro-0.8.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "defa6e3ed45aee2050b71429020cf9ac",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 102039,
            "upload_time": "2024-04-09T19:25:30",
            "upload_time_iso_8601": "2024-04-09T19:25:30.044289Z",
            "url": "https://files.pythonhosted.org/packages/8a/f6/0b3dca524fdba07dff7b1a029e5546212440e7d2ebd60fc5fc3f4c5d0fbc/tyro-0.8.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1673b1d81353d7d104d13da8d8d657f436ae5141a9fe253983bac7883c573e59",
                "md5": "cbc1c420d7843ba65e6360f30a001892",
                "sha256": "b320d92cc411973b399a31bf779117d56b754e18d926531f8e2c6a309af5a0fb"
            },
            "downloads": -1,
            "filename": "tyro-0.8.3.tar.gz",
            "has_sig": false,
            "md5_digest": "cbc1c420d7843ba65e6360f30a001892",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 129357,
            "upload_time": "2024-04-09T19:25:32",
            "upload_time_iso_8601": "2024-04-09T19:25:32.375226Z",
            "url": "https://files.pythonhosted.org/packages/16/73/b1d81353d7d104d13da8d8d657f436ae5141a9fe253983bac7883c573e59/tyro-0.8.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-09 19:25:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "brentyi",
    "github_project": "tyro",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "tyro"
}
        
Elapsed time: 0.21124s