This release is a pre-release and may not be stable for production use.
ctlbase
An asyncio-based framework for creating CLI utilities and service daemons.
For CLI utilities, it supports ...
- ... sharing a common set of arguments across utlities, backed by default implementations.
- ... message output in plain text or JSON to stdout and stderr.
- ... setting so-called modes, i.e. persistent flags with an optional timeout after which the flag is unset automatically.
For both CLI utilities and service daemons, it supports ...
- ... auto-discovery of associated files, e.g. configuration files.
- ... parsing Bash-style configuration files.
- ... reading credentials from a file, a keyring, TPM2 or a user prompt.
- ... sophisticated message handling in English, supporting translations into other languages.
- ... automated exit code generation based on error and warning messages.
For service daemons, it supports ...
- ... logging to a file instead of or in addition to stdout and stderr.
- ... rendering credentials in various output formats, to be picked up by systemd services.
- ... automated logging of asyncio task results.
For apidocs, see https://xoocoon.github.io/ctlbase.
Core concepts
To understand the core concepts of the package, it is advisable to read the introduction of the control apidoc.
An example for a Bash-style configuration file is included in the repo under templates/etc/bashconfig. It can be used to initialize a Control instance or a ControlShell instance.
As an example for a i18next-like translation file, see the file templates/locales/de/translation.json in the repo. It can be used with the addTranslations() method of a MessageBuffer instance.
Installation
Package dependencies
The following packages need to be installed:
- aiofiles, for accessing files with asyncio
- keyring, if you want to retrieve credentials from your desktop environment's keyring, e.g. libsecret/Seahorse.
If you install ctlbase in a virtual Python environment, as recommended under Package installation, dependencies will be installed automatically as needed.
On a Debian-based system, the dependencies can be installed as follows:
sudo apt update && sudo apt install -y python3-aiofiles python3-keyring
Package installation
For installing the ctlbase package you have at least two choices:
- Install the latest release from PyPI via
pip. - Install directly from a local clone of the GitHub repo.
In both cases, it is recommended to use a virtual Python environment to encapsulate all the required dependencies. See https://docs.python.org/3/library/venv.html for details on how to create one.
For installing from PyPI, use the pip command of your target environment as follows:
pip install ctlbase
For installing from a local clone of the GitHub repo, use the pip command of your target environment as follows:
pip install $CTLBASE_PATH
... where $CTLBASE_PATH resolves to the root directory of the repo containing the pyproject.toml file.
In both cases, if you want to retrieve credentials from your desktop environment's keyring, install the optional keyring dependency by appending [keyring] to the command.
Metadata
Release files for ctlbase 1.0a2
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 | |
|---|---|---|---|---|
| ctlbase-1.0a2.tar.gz | 59.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ctlbase-1.0a2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 126.3 kB
Release files / ctlbase-1.0a2.tar.gz
| Download URL | ctlbase-1.0a2.tar.gz |
|---|---|
| Size | 59.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d1b5949016504b52f2c063b710278e31fa77cace63a97a51f2c1bb8ae55ca921
|
|
BLAKE2b-256 checksum How to use checksums |
4e1128c93815f654533ec309a7e0c8dc10abeecc0a8d354c64decc3ce107aa52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.2
|
Release files / ctlbase-1.0a2-py3-none-any.whl
| Download URL | ctlbase-1.0a2-py3-none-any.whl |
|---|---|
| Size | 66.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a2fa562fecb3dd4193525edf19bdaf1b7d69d808bc17afda7f109241a00ca656
|
|
BLAKE2b-256 checksum How to use checksums |
c0a0af28b72d4695fb07e296e77f1af314b0ed623e1a5428e5c68a20d04e0ae5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.2
|
Security for ctlbase 1.0a2
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.