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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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