YAML-driven CLI framework — turn any REST API into CLI commands
Project description
cliyard
CLI + YAML + Yard — a framework that generates CLI commands from YAML specs. Define your REST API in a few YAML files, and cliyard produces a fully-structured Click CLI with parameters, types, and auto-generated help. Originally inspired by ketacli's YAML-driven architecture, now generalized for any REST API.
Installation
pip install cliyard
For local development:
pip install -e .
Quick Start
# Explore the example spec
cliyard --spec-dir examples/ketacli-repos/ repos list --help
# Usage: repos list [OPTIONS]
# --page INTEGER Page number
# --search TEXT Search keyword
# --help Show this message and exit.
How It Works
cliyard turns a directory of YAML files into CLI commands. One directory equals one API service. Each YAML file (except _service.yaml) becomes a resource group with subcommands for every defined method.
your-api/ ┌─────────────────────────────────┐
├── _service.yaml ── service ──► │ cliyard Engine │
├── repos.yaml ── resource ──► │ │
├── users.yaml ── resource ──► │ Loader ──► Builder ──► Click │
└── ... │ │ │ │ │
│ │ Auth Chain │ │
│ ▼ ▼ ▼ │
│ YAML Commands CLI run │
│ parsing + params │
└─────────────────────────────────┘
Data flow for a single invocation:
cliyard --spec-dir examples/ketacli-repos/ repos list --page 1
1. Loader reads _service.yaml + repos.yaml
2. Auth chain runs (env → login → inject token)
3. Builder generates Click commands from method specs
4. Params are typed (int, string, enum, bool) and validated
5. (Future) HTTP request is assembled and sent
6. (Future) Response is formatted with Rich tables
Directory Structure
Each service is a directory containing a _service.yaml for service-level config and one YAML file per resource:
ketacli-repos/
├── _service.yaml # Service config: name, server, auth
└── repos.yaml # Resource: repos (list, create, get, update, delete)
_service.yamldefines the server URL, authentication chain, and global settings.- Resource files (
repos.yaml,users.yaml, etc.) define the methods, parameters, and output format for each API resource. - Files prefixed with
_service.(like_service.local.yaml) are reserved for future local overrides and are ignored during loading.
Comparison with ketacli
| Feature | cliyard | ketacli |
|---|---|---|
| API scope | Any REST API | KetaDB only |
| Config format | One directory per API service | Single YAML tree per resource |
| Auth model | Chain-based (env, login, inject) | Built-in, KetaDB-specific |
| Auth caching | In-memory TTL token cache | Session-based |
| Param types | string, int, float, bool, enum | Pre-defined per command |
| Adding resources | Add a YAML file to the directory | Requires code changes |
| CLI generation | Dynamic from spec at runtime | Pre-built Click commands |
| Purpose | General-purpose API-to-CLI framework | KetaDB management tool |
Creating Your Own Spec
See examples/README.md for a step-by-step guide to creating new API specs.
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 cliyard-0.3.2.tar.gz.
File metadata
- Download URL: cliyard-0.3.2.tar.gz
- Upload date:
- Size: 59.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
283cb55885e528471a5637cb6045b552cc92bf159ce298c50953cd80036519fe
|
|
| MD5 |
e7a70249263974dcbf44b818da6211f2
|
|
| BLAKE2b-256 |
b75e5d5e4d51c69f2461ee501468542e96de09adfe2fd3eb742a35d9b566f912
|
Provenance
The following attestation bundles were made for cliyard-0.3.2.tar.gz:
Publisher:
publish.yml on guolong123/cliyard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cliyard-0.3.2.tar.gz -
Subject digest:
283cb55885e528471a5637cb6045b552cc92bf159ce298c50953cd80036519fe - Sigstore transparency entry: 2211066343
- Sigstore integration time:
-
Permalink:
guolong123/cliyard@a97cff14d98bbf0582ebd1a55e840fc34a16f3d7 -
Branch / Tag:
refs/tags/0.3.2 - Owner: https://github.com/guolong123
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a97cff14d98bbf0582ebd1a55e840fc34a16f3d7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file cliyard-0.3.2-py3-none-any.whl.
File metadata
- Download URL: cliyard-0.3.2-py3-none-any.whl
- Upload date:
- Size: 59.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4322c7816e8ea3fa41757da5162b24d460f87ea5ceb6f275a4311c210757b4fd
|
|
| MD5 |
f83886833d2b9cf1440051325da5b7e0
|
|
| BLAKE2b-256 |
6e2b3cab9a434991e1b071b82b40e43dbd71c1618f3a1025f514073314faa561
|
Provenance
The following attestation bundles were made for cliyard-0.3.2-py3-none-any.whl:
Publisher:
publish.yml on guolong123/cliyard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cliyard-0.3.2-py3-none-any.whl -
Subject digest:
4322c7816e8ea3fa41757da5162b24d460f87ea5ceb6f275a4311c210757b4fd - Sigstore transparency entry: 2211066405
- Sigstore integration time:
-
Permalink:
guolong123/cliyard@a97cff14d98bbf0582ebd1a55e840fc34a16f3d7 -
Branch / Tag:
refs/tags/0.3.2 - Owner: https://github.com/guolong123
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a97cff14d98bbf0582ebd1a55e840fc34a16f3d7 -
Trigger Event:
release
-
Statement type: