Skip to content

clima

Create a command line interface with minimal setup. PyPI Python versions PyPI license

Quick example

from clima import Schema

class S(Schema):
    name: str = 'world'

@S.cli
class Cli:
    def greet(self):
        print(f'Hello, {S.name}!')
pip install clima
python app.py greet --name Ada
# Hello, Ada!

Install

pip install clima

Python 3.9+.

Features

  • Subcommands from class methods
  • Configuration cascade, in order of priority: CLI args > env > .env > config file > Schema defaults
  • Parses --help from docstrings and field comments
  • Define CLI parameters as a Schema class with defaults and types
  • Type casting from annotations
  • IDE completions work out-of-the-box
  • Optional logging with --verbose / --quiet
  • Version subcommand for poetry-packaged tools

Documentation