Clout: Command-Line Object Utility Tool¶
docs | |
---|---|
code | |
tests | |
package |
Convert dataclasses into a command-line interface.
Quickstart¶
To install, use
pip install clout
Define some dataclasses and convert them into a command-line interface.
import attr
import click
import clout
@attr.dataclass
class DB:
host: str
port: int
@attr.dataclass
class Config:
db: DB
dry_run: bool
cli = clout.Command(Config)
print(cli.build())
$ myapp --dry-run db --host example.com --port 9999
Config(db=DB(host='example.com', port=9999), dry_run=True)
See the full docs for more information: https://clout.readthedocs.io/