Skip to main content

Use pydantic to manage persistent config for your Typer 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.2.0.tar.gz (20.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.2.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for typer_pydantic_config-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ce8f1a0362245749ca25b1f20262b2b984bae514392ca3f5fadfd9896ba392a3
MD5 2053f160c40bd48c95ec9ab4d27a3b66
BLAKE2b-256 ef2fded109fe3fc26234534d37224eb755e3d160a91d44121733d9b71b2381a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for typer_pydantic_config-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4591a0061816f5e94fd73a5711868deeca2e2c4353d87f121c23a5f669fb3a8d
MD5 68ffb0ba71acefd979e1ee86bc5bc66e
BLAKE2b-256 baeb4f8cb83da1b22a43a165d1d4d3857f7b78bfd79cc855339a42351cbb39ad

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