Skip to main content

usage-spec

Core types and rendering for usage spec.

Install

pip install usage-spec

API

Types

@dataclass
class Spec:
    name: str
    bin: str
    version: str
    about: str
    long: str
    usage: str
    flags: list[SpecFlag]
    args: list[SpecArg]
    cmds: list[SpecCommand]

Functions

from usage_spec import generate, render_kdl, render_json, validate_kdl

# Render Spec as KDL string
render_kdl(spec: Spec) -> str

# Render Spec as JSON string
render_json(spec: Spec) -> str

# Generate spec output with optional format and comment
generate(spec: Spec, format: str = "kdl", comment: str | None = None) -> str

# Validate KDL string by basic structural check
validate_kdl(kdl: str) -> None

License

MIT

Release files for usage-spec 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for usage-spec 1.2.0
File Size Uploaded
usage_spec-1.2.0.tar.gz 5.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for usage-spec 1.2.0
File Interpreter ABI Platform
usage_spec-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.0 kB

Release files / usage_spec-1.2.0.tar.gz

Download URL usage_spec-1.2.0.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0cb27581d79e0c3299c956642957e724838dad3ba9faeb7164a5a1e6daf7b30a
BLAKE2b-256 checksum
How to use checksums
c49803cee6cd613da11ef56b828bcb26d03d5e8abeba4ae16c897cbb91621f77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.14

Release files / usage_spec-1.2.0-py3-none-any.whl

Download URL usage_spec-1.2.0-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7df71345ce2de0547ff145b53d3a14f7336bb2728784beff1ea8f728f192a78c
BLAKE2b-256 checksum
How to use checksums
f7471a4c3f9093fb28e6d0586fb2f7502f02d1d77d0c80508ffb206542327668
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.14

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page