chancleta
Python library for creating command line interfaces in a composable way via configuration files.
Supports .toml, .json, .yaml. and (if you'd like to be more adventurous) .xml.
How to use
- Describe configurations in a chancleta.toml file.
(File format could vary between .toml, .json, .yaml and .xml as long as the name remains the same.)
Add mandatory 'meta' data with general information about your program
[meta]
src = "testoo.util.commands"
prog = "foo"
version = "0.1.0"
description = "Test my new flip flops"
usage = "Take that jive Jack, put it in your pocket 'til I get back"
'src' points to the directory where the corresponding python functions are to be found and called with arguments read from the terminal
- Configure subcommands as separate tables (objects if you're using JSON)
[yes]
description = "Simple yes function"
argument = { name = "text", help = "Some dummy text" }
option = { name = "should-repeat", short = "r", flag = "True", help = "should repeat text 5 times" }
help = "yes func"
function = "yes"
function shows the name of the python function to be called
- If you have multiple arguments/options - put them as inline tables inside arrays
[echo]
arguments = [
{ name = "text", help = "Some dummy text" },
{ name = "mark", type = "str", help = "Final mark" },
]
options = [
{ name = "other-text", short = "o", default = "Panda", dest = "other", help = "Some other dummy text" },
{ name = "delimiter", default = ", ", help = "use DELIM instead of TAB for field delimiter" },
{ name = "num", default = 42, type = "int", help = "some random number to make things pretty" }
]
function = "echo"
chancleta supports advanced features such as choices, nargs, dest (for options), type validation
[maybe]
argument = { name = "number", type = "int", choices = [3, 5, 8], help = "Some meaningless number" }
option = { name = "other-number", type = "int", nargs = "*", choices = [1, 2], dest = "other", help = "Other marvelous number" }
function = "maybe"
- For boolean flags you could use
options = [
{ name = "should-log", flag = "False", default = true },
{ name = "should-repeat", flag = "True"}
]
which is equivalent to
action="store_false"...
action="store_true"...
- If no short name is given for an option, the first letter of the full name is used
- Inside your program import the Chancleta object, pass a path to the directory where your config file lives and call the parse method
from chancleta import Chancleta
def main():
Chancleta("./testoo/config").parse()
If no path is given chancleta will try to find the config file inside the root directory of your project
Metadata
Release files for chancleta 1.0.3
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 |
|---|---|---|---|---|
| chancleta-1.0.3.tar.gz | 4.7 kB | Without provenance | Details for chancleta-1.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chancleta-1.0.3-py3-none-any.whl | Python 3 | none | any | Details for chancleta-1.0.3-py3-none-any.whl |
Total release size: 10.2 kB
Release files / chancleta-1.0.3.tar.gz
| Download URL | chancleta-1.0.3.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c0be4935e5273a22d8b250b636025bde59f8cea91ffbd48cbeb4c437bfe1ab53
|
|
BLAKE2b-256 checksum How to use checksums |
a413f84665afc2967d6adab64e1d39c46a20e2879ba34e050eed25d0fdfa73ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.0 CPython/3.12.3 Linux/6.8.0-51-generic
|
Release files / chancleta-1.0.3-py3-none-any.whl
| Download URL | chancleta-1.0.3-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9658117ee227160d1a52cf137ddff3d77ff960aa8a4336a7e476345c2c8e1d49
|
|
BLAKE2b-256 checksum How to use checksums |
a0a60092d129f4cbf6f32cce6d0ddf54d448f9d0de6417379d5d7820eb181125
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.0 CPython/3.12.3 Linux/6.8.0-51-generic
|
Security for chancleta 1.0.3
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.