clima
Create a command line interface with minimal setup.
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
--helpfrom 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
- Getting started -- install and first CLI in 5 minutes
- Configuration -- config files, env, type casting, logging
- Examples -- runnable examples
- Reference -- full API reference