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.0.tar.gz (20.8 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.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for typer_pydantic_config-0.3.0.tar.gz
Algorithm Hash digest
SHA256 483b33eb6812a916e7bad9c1ea33c068358bd6fc6402d9893e5d04d50fed554d
MD5 ab001a34d3b5f8d66a69c18bd63a8024
BLAKE2b-256 7685c2bab73b2ed942d20a503cc25d4af4cfde73780c78e929683d4990ead98a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for typer_pydantic_config-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 af5f7c2239d1559ced8a5596cdad697bdc2064cb7a1848be115e8f4c33b9c663
MD5 19d010a75fcfdc6b4710275695fecde9
BLAKE2b-256 910880bfcb097b8ace627c7546a70054d4ebf7a4bb7764db1ae151d940aef829

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