Recursive hierarchical CLI framework with typed configs and YAML synthesis
Project description
NanoCLI
A cli framework with the simplicity of argparse, the colors of rich, the config handling of Hydra, and without the complexity.
Installation
pip install nanocli
Quick Start
from dataclasses import dataclass
from nanocli import group
@dataclass
class TrainConfig:
epochs: int = 100
lr: float = 0.001
app = group()
@app.command()
def train(cfg: TrainConfig):
print(f"Training for {cfg.epochs} epochs")
if __name__ == "__main__":
app()
Usage
# Run command
python app.py train
python app.py train epochs=200
# Hydra-style overrides at root level
python app.py train.epochs=200 -p
# Print config: -p (local), -g (global from root)
python app.py train -p
# Load YAML config
python app.py -c examples/train_config.yml train
# Help
python app.py -h
python app.py train -h
Nested Groups
app = group()
@app.command()
def train(cfg: TrainConfig):
...
data = app.group("data", help="Data commands")
@data.command()
def download(cfg: DownloadConfig):
...
python app.py data download
python app.py data download path=/data -p
python app.py data download -g # prints full tree from root
Flags
| Flag | Meaning |
|---|---|
-p |
Print config from current node |
-g |
Print config from root (global) |
-h |
Show help |
-c PATH |
Load base config from YAML |
Development
make dev # Install with dev deps
make test # Run tests
make pre-commit # Run all checks
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nanocli-0.1.1.tar.gz.
File metadata
- Download URL: nanocli-0.1.1.tar.gz
- Upload date:
- Size: 324.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c2a47aaf06c538dfbf54eb865435cbf6a58ebad73d2c78d8f71e2f4e250eacb
|
|
| MD5 |
3e4317567af44a59c228b60dbbbb2bef
|
|
| BLAKE2b-256 |
766f6c6d16f82f55af6029a7fe1c310522e7249f7cbd933328eaf218f2b57032
|
Provenance
The following attestation bundles were made for nanocli-0.1.1.tar.gz:
Publisher:
publish.yml on jaisw7/nanocli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nanocli-0.1.1.tar.gz -
Subject digest:
0c2a47aaf06c538dfbf54eb865435cbf6a58ebad73d2c78d8f71e2f4e250eacb - Sigstore transparency entry: 772211584
- Sigstore integration time:
-
Permalink:
jaisw7/nanocli@69a203e55dbe1a333d0779e659c4400ba97b7c7b -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/jaisw7
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@69a203e55dbe1a333d0779e659c4400ba97b7c7b -
Trigger Event:
release
-
Statement type:
File details
Details for the file nanocli-0.1.1-py3-none-any.whl.
File metadata
- Download URL: nanocli-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
205b0d3fe8e72d26a96957667da74bd769d53e14795342c2c83b4ab36ab1200b
|
|
| MD5 |
eb2624dd5541d9afc7a95ebe32337444
|
|
| BLAKE2b-256 |
8aef498a1907f838e9888a7145b7a0a61e9ed27891b5c0b2aa6a79f286118013
|
Provenance
The following attestation bundles were made for nanocli-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on jaisw7/nanocli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nanocli-0.1.1-py3-none-any.whl -
Subject digest:
205b0d3fe8e72d26a96957667da74bd769d53e14795342c2c83b4ab36ab1200b - Sigstore transparency entry: 772211585
- Sigstore integration time:
-
Permalink:
jaisw7/nanocli@69a203e55dbe1a333d0779e659c4400ba97b7c7b -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/jaisw7
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@69a203e55dbe1a333d0779e659c4400ba97b7c7b -
Trigger Event:
release
-
Statement type: