Skip to main content

Declarative rich CLI

Project description

deric — DEclarative RIch Cli

Minimal library to build CLI apps with integrated TOML config file.

Goals

  • Minimal and useful
  • Subcommand support
  • Type checked arguments
  • Integrated logging handling
  • Reuse existing proved libraries: pydantic and rich
  • Use either CLI args, environment variables or TOML configuration (or a mix of them)

Usage

simple_app.py:

from deric import Command, arg

# define a simple app
class SimpleApp(Command):
  name = "your_simple_app"
  description = "Print a value and exit"

  Config = {
    "string": arg(str, ..., "value to print")
    "value": arg(int, 4, "value to print")
  }

  def run(self, config):
    print(config.string, config.value * 2)

SimpleApp().start()

Run it with:

python simple_app.py --string "some string" --value 21

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

deric-0.2.3.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

deric-0.2.3-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file deric-0.2.3.tar.gz.

File metadata

  • Download URL: deric-0.2.3.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/6.2.0-1018-azure

File hashes

Hashes for deric-0.2.3.tar.gz
Algorithm Hash digest
SHA256 40d4037db57168310bbecc3c049629e4a5f33a873d890071d3434a8a6d8e9dc5
MD5 62f0b9bed024434e4d470d5f4b921fae
BLAKE2b-256 dcf43b46cfdbc6a8fdb471ae131f34b784bf911b30dd0a9b1387c8156c2dcfcb

See more details on using hashes here.

File details

Details for the file deric-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: deric-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/6.2.0-1018-azure

File hashes

Hashes for deric-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0d8cc4c7223acb138a644594070392804e16dd63dd39aee03810da9891275e3a
MD5 0e6d341bb4acc4dc6e6cd4f6d0c049ae
BLAKE2b-256 50c5fbe31556f86379cbaa85dbaa3b084b4791b429edd06be64b8378b6940560

See more details on using hashes here.

Supported by

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