Skip to main content

typer-config

GitHub Workflow Status (with branch) Codecov PyPI PyPI - Downloads Libraries.io dependency status for latest release

This is a collection of utilities to use configuration files to set parameters for a typer CLI. It is useful for typer commands with many options/arguments so you don't have to constantly rewrite long commands. This package was inspired by phha/click_config_file and prototyped in this issue. It allows you to set values for CLI parameters using a configuration file.

Installation

$ pip install typer-config[all]

Note: that will include libraries for reading from YAML, TOML, and Dotenv files as well. Feel free to leave off the optional dependencies if you don't need those capabilities.

Usage

# Long commands like this:
$ my-typer-app --opt1 foo --opt2 bar arg1 arg2

# Can become this:
$ my-typer-app --config config.yml

Quickstart

You can use a decorator to quickly add a configuration parameter to your typer application:

import typer
from typer_config import use_yaml_config

app = typer.Typer()


@app.command()
@use_yaml_config()  # MUST BE AFTER @app.command()
def main(foo: FooType): ...


if __name__ == "__main__":
    app()

Your typer command will now include a --config CONFIG_FILE option at the command line.

Note: this package also provides @use_json_config, @use_toml_config, and @use_dotenv_config for those file formats. You can also use your own loader function and the @use_config(loader_func) decorator.

See the documentation for more examples using typer-config.

Metadata

Release files for typer-config 1.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for typer-config 1.5.1
File Size Uploaded
typer_config-1.5.1.tar.gz 10.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for typer-config 1.5.1
File Interpreter ABI Platform
typer_config-1.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 24.0 kB

Release files / typer_config-1.5.1.tar.gz

Download URL typer_config-1.5.1.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
78be341f6894f44d6f2dc6b01f6eef83b9381d16c11341b12d6b8a245a3fb451
BLAKE2b-256 checksum
How to use checksums
2183816a6556bb8f4acaa10e908f609557be00f3df2cae98c4216e4b75235c45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / typer_config-1.5.1-py3-none-any.whl

Download URL typer_config-1.5.1-py3-none-any.whl
Size 13.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a13bb7d0043231c58e0ec28195a4f54a08116a48b0d61ca49af13f83ef3a846e
BLAKE2b-256 checksum
How to use checksums
3be1e51631c3454838faecf73c95dcfbc337654bdef8ac68671973e2ca823265
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

1.5.1 This release

2 release files

1.5.0

2 release files

1.4.3

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page