Declinate
Declinate is a command line interface generator. It is a development tool that parses function type annotations and docstrings to generate Python CLIs:
It uses builtin language features to describe CLIs.
Declinate is not a runtime dependency, it compiles to vanilla Python argparse calls during development.
Generated CLIs use lazy imports, resulting in extremely fast startup time.
Command completion for Bash and Zsh are added by default.
Getting started
Declinate is published on PyPI and does not have any special dependencies. Simply install with pip:
pip install declinate
The package installs the declinate command to generate a CLI for a python package:
# Print python code to stdout. declinate generate example_pkg # Write cli.py module in example_pkg package. declinate generate -w example_pkg
Of course, declinate’s own CLI is “self-hosting” and can recreate itself:
declinate generate declinate
Declinate expects the python package to declare its command and subcommands in a module named declinate.py. Here is how declinate’s own “check” subcommand is declared:
def check(package: str) -> int:
"""Check if generated cli is up to date.
Args:
package: Name of the Python package.
Returns:
0 if success.
"""
if res := check_package(package):
print(res)
return 1
return 0
Take a closer look at the different example CLIs in the tests package that demonstrate the various features.
Documentation
Read the documentation for further information.
Contributing
Thank you for considering to contribute to declinate.
To submit issues or create merge requests please follow the instructions provided in the contribution guide.
By contributing to declinate you accept and agree to the terms and conditions laid out in there.
Development
Clone the repository and setup your local checkout:
git clone https://gitlab.com/ternaris/declinate.git cd declinate python -m venv venv . venv/bin/activate pip install -r requirements-dev.txt pip install -e .
This creates a new virtual environment with the necessary python dependencies and installs declinate in editable mode. The declinate code base uses pytest as its test runner, run the test suite by simply invoking:
pytest
To build the documentation from its source run sphinx-build:
sphinx-build -a docs public
The entry point to the local documentation build should be available under public/index.html.
Support
Professional support is available from Ternaris.
Metadata
Release files for declinate 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| declinate-0.0.7.tar.gz | 117.9 kB | Without provenance | Details for declinate-0.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| declinate-0.0.7-py3-none-any.whl | Python 3 | none | any | Details for declinate-0.0.7-py3-none-any.whl |
Total release size: 138.5 kB
Release files / declinate-0.0.7.tar.gz
| Download URL | declinate-0.0.7.tar.gz |
|---|---|
| Size | 117.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
baa47db69913a3f5b6ea2d232babc8d5525b188182b59e9b9ba673cf484276bb
|
|
BLAKE2b-256 checksum How to use checksums |
b41a781dc1e6192a772c7262b728a521bdeebaa556755ab26c5265a1d07d8d8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / declinate-0.0.7-py3-none-any.whl
| Download URL | declinate-0.0.7-py3-none-any.whl |
|---|---|
| Size | 20.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d8d64677df3b442cf0eada73bba2f9024605888b33ddb2919d9f2e17e8cc5ec7
|
|
BLAKE2b-256 checksum How to use checksums |
1b648adbe5259ec642424a6f72969190eb51f5490450da33289b790c049d8608
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for declinate 0.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.