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, response formatting, and auto-generated help.
Installation
pip install cliyard
# Or for development
pip install -e .
Quick Start
# Generate a CLI from spec files
cliyard gen --name mycli --defs-path ./specs/
cd mycli && pip install -e .
# Use it
mycli --help
mycli repos list --page-size 10
How It Works
cliyard turns a directory of YAML files into CLI commands. One directory equals one API service. Each YAML file becomes a resource group with subcommands for every defined method.
specs/
├── _auth.yaml # Service config: name, servers, auth chain
├── _groups.yaml # (optional) Group definitions for nesting
├── _flows.yaml # (optional) Flow orchestration index
├── resources/ # Resource YAML files
│ ├── repos.yaml
│ └── ...
├── flows/ # (optional) Flow step definitions
│ ├── _flow_create_repo.yaml
│ └── ...
└── plugins/ # Python plugins
└── *.py
Data flow for a single invocation:
CLI input → bind & validate → auth chain → assemble request → HTTP call → format response
Features
- YAML-driven: Add a new API resource by creating a
.yamlfile, no code changes - Plugin system: 7 extension points for auth, types, hooks, methods, commands, field resolvers, flow steps
- Flow orchestration: Define multi-step workflows with conditional branching, loops, and lifecycle hooks
- Multi-server: Support multiple API endpoints in a single CLI
- Rich output: Tables, JSON, CSV formatting with datetime conversion
- Resource grouping: Nest related commands under parent groups
Examples
See the examples/ directory for ready-to-use spec sets:
examples/demo/— Pet Store API demo with resource commands, plugins, and flow orchestration
# Library mode (read YAML at runtime)
python3 -c "from cliyard.runtime import create_cli; create_cli('examples/demo')()"
# Flow orchestration
petstore flow-run add-user --name 张三
petstore flow-run retry-demo
petstore flow-run plugin-demo
petstore flow-run hook-demo
Documentation
Generated CLI projects include a README.md with full usage docs covering:
- Usage & environment management
- Adding new resources
- Plugin authoring (all 7 plugin types)
- Flow orchestration with conditional branching, loops, and hooks
- Multi-server configuration
- Custom method plugins
License
MIT
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.4.2.tar.gz.
File metadata
- Download URL: cliyard-0.4.2.tar.gz
- Upload date:
- Size: 88.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 |
93a0ff19fff5a02585649ac4da40d76a2ab164c0f546cb498ab740b140d4c578
|
|
| MD5 |
c95806cabc4abbe8c09067be01268255
|
|
| BLAKE2b-256 |
fe9c56c2b861d41da320e1eae5cfb29ca0906eabc5ac0cdfa465db00117bfd29
|
Provenance
The following attestation bundles were made for cliyard-0.4.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.4.2.tar.gz -
Subject digest:
93a0ff19fff5a02585649ac4da40d76a2ab164c0f546cb498ab740b140d4c578 - Sigstore transparency entry: 2257123810
- Sigstore integration time:
-
Permalink:
guolong123/cliyard@f0606b319fc6513e482df1d1ad0e177845430c7b -
Branch / Tag:
refs/tags/0.4.2 - Owner: https://github.com/guolong123
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f0606b319fc6513e482df1d1ad0e177845430c7b -
Trigger Event:
release
-
Statement type:
File details
Details for the file cliyard-0.4.2-py3-none-any.whl.
File metadata
- Download URL: cliyard-0.4.2-py3-none-any.whl
- Upload date:
- Size: 83.3 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 |
540d9eb6f42bbf8e9e670a723951b55dae7303a8caf352a95b4a6dda09ed61d7
|
|
| MD5 |
b52e4da9df4e1916c97faea768879fc1
|
|
| BLAKE2b-256 |
4773bb705f059d930b99d59cbae4915d32791e5277fbbe1fe03368c8fafcad91
|
Provenance
The following attestation bundles were made for cliyard-0.4.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.4.2-py3-none-any.whl -
Subject digest:
540d9eb6f42bbf8e9e670a723951b55dae7303a8caf352a95b4a6dda09ed61d7 - Sigstore transparency entry: 2257123821
- Sigstore integration time:
-
Permalink:
guolong123/cliyard@f0606b319fc6513e482df1d1ad0e177845430c7b -
Branch / Tag:
refs/tags/0.4.2 - Owner: https://github.com/guolong123
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f0606b319fc6513e482df1d1ad0e177845430c7b -
Trigger Event:
release
-
Statement type: