Skip to main content

Use [pydantic](https://docs.pydantic.dev/latest/) to manage persistent config for your [Typer](https://typer.tiangolo.com/) CLI apps!

Project description

Typer Pydantic Config

This package helps you quickly build python CLI applications with a persistent config.

  1. Implement config object as pydantic class
  2. Use get_config where every you need the current values
  3. Build a normal app with typer
  4. start the app with start_config_app

On the first invocation, prompts the user to set all values in the config file.

Your app now has an additional config command with the following signature:

Usage: example.py config [OPTIONS] COMMAND [ARGS]...

  Interact with config: ( set | init | show | path | delete).

Options:
  --help  Show this message and exit.

Commands:
  delete  Delete config file on disk.
  init    Interactively prompt for every field in the config.
  path    Print config path.
  set     Set one or more config fields via flags.
  show    Print content of config file.

 Current shortcomings 

  • Supports only the following basic types:
    • Pydantic model
    • int
    • float
    • bool
    • str
    • datetime
    • Path

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

typer_pydantic_config-0.3.1.tar.gz (21.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

typer_pydantic_config-0.3.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file typer_pydantic_config-0.3.1.tar.gz.

File metadata

File hashes

Hashes for typer_pydantic_config-0.3.1.tar.gz
Algorithm Hash digest
SHA256 69bf1e5dd66c870a6fae92f0468c7286f99ffffd12347a17e627416945971775
MD5 03f77eeb13fb8da95b90eb49d538e236
BLAKE2b-256 b3fbaa30607f82f315c60f5f17801e3ec29386c4479230600de68ef8f609a8da

See more details on using hashes here.

File details

Details for the file typer_pydantic_config-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for typer_pydantic_config-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 90d4a19e43ab47925b3fd2c36a5caa1c9f95041fb7e93412c7ea9dc93887279a
MD5 5d5b06151cd869c3e80deaa02f7b7880
BLAKE2b-256 5cf98047be0af6f31f3e2774bfd29a5569d3324e9a65062e7201ae29336b609f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page