Registry / devops / clikit

clikit

JSON →
library0.6.2pypypi✓ verified 28d ago

CliKit is a Python library providing a collection of utilities to build robust and testable command-line interfaces. It serves as a foundational component for other CLI frameworks like Cleo. The library is currently at version 0.6.2, with its last release in June 2020, indicating a maintenance phase following a period of active development in late 2019 and early 2020.

pip install clikit
INSTALL
IMPORT
SIG · CLIKIT
C
clikit
devopspythonv0.6.2
Install
1.7s avg
Import
139ms
Disk
18MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.6.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.142s · 19.5MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 1.7s · import 0.136s · 20MB
18MB installed
● package 18MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Application
✓ from clikit.api.application import Application
Command
✓ from clikit.api.command import Command
Argument
✓ from clikit.api.args import Argument
Option
✓ from clikit.api.args import Option
IO
✓ from clikit.ui.io import IO
✗ from clikit.ui.output import Output
While `Output` exists, `IO` is a more general interface for input/output, often used directly for `write_line` and accessing arguments, especially with progress bar changes in v0.6.1.

This example demonstrates how to create a simple CLI application with a single 'hello' command that accepts a required argument for a name and an optional flag to make the greeting loud. It initializes an `Application`, adds the custom `HelloCommand`, and runs the application.

from clikit.api.application import Application from clikit.api.command import Command from clikit.api.args import Argument, Option from clikit.ui.io import IO class HelloCommand(Command): def __init__(self): super().__init__() self.set_name("hello") self.set_description("Greets the given name.") self.add_argument(Argument("name", Argument.REQUIRED, "The name to greet.")) self.add_option(Option("loud", "l", Option.NO_VALUE, "Make the greeting loud.")) def handle(self, io: IO): name = io.args.get("name") loud = io.args.get("loud") message = f"Hello, {name}!" if loud: message = message.upper() io.write_line(message) if __name__ == "__main__": application = Application("My CLI App", "1.0.0") application.add_command(HelloCommand()) application.run()
Debug
Known issues
breakingVersion 0.4.0 introduced changes to how event names are stored and exposed.
fix
Review any custom event listeners or code interacting with internal event name structures and update them to conform to the new pattern.
affects: >=0.4.0
gotchaDefault progress bar update rate was limited to a maximum of every 100ms in v0.6.1.
fix
If faster progress bar updates are required, configure the update rate using the `min_seconds_between_redraws()` method on the progress bar instance.
affects: >=0.6.1
gotchaProgress bars and indicators passed an `IO` instance will now default to using the error output stream (`stderr`) instead of standard output (`stdout`).
fix
Explicitly pass an `Output` instance (if available, which typically wraps `stdout`) or ensure your `IO` instance is configured to use the desired output stream if progress should not appear on `stderr`.
affects: >=0.6.1
gotchaCompatibility with the `pastel` dependency was a known issue that required fixes in v0.4.2.
fix
Ensure you are using `clikit` v0.4.2 or newer with compatible versions of `pastel` to avoid rendering or display issues.
affects: <0.4.2
gotchaEarly versions (e.g., 0.4.1, 0.4.3) had specific fixes for Python 2.7 related to encoding errors in questions and exception trace rendering.
fix
While `clikit` supports Python 2.7, it is recommended to use the latest version (0.6.2) for improved Python 2.7 stability, or ideally migrate to Python 3 for better overall support and future compatibility.
affects: <0.5.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'clikit'
This error occurs when the 'clikit' package is not installed in the Python environment or is not accessible within the current project's dependencies.
fix
Install the 'clikit' package using pip: `pip install clikit` or if using Poetry, add it to your project dependencies: `poetry add clikit`.
NoSuchOptionException The "-<option_name>" option does not exist.
This error, often encountered when using tools like Poetry which rely on CliKit, indicates that a command-line option passed to a CliKit-based application is not defined or recognized by the command's argument format.
fix
Check the documentation or help message of the command-line tool (e.g., `poetry <command> --help`) to verify the correct options and their syntax. Ensure you are not mistyping options or attempting to use options that are not implemented.
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
This error typically arises when CliKit attempts to read or process text (e.g., from configuration files, environment variables, or standard input/output) that is encoded in a different format than UTF-8, which Python (especially on certain systems or with misconfigured locales) might expect by default.
fix
Ensure that the environment's locale settings are correctly configured to use UTF-8. On Unix-like systems, you might set environment variables like `LANG=en_US.UTF-8` and `LC_ALL=en_US.UTF-8`. For specific file operations, explicitly specify the correct encoding when opening files (e.g., `open('file.txt', 'r', encoding='latin-1')`). As a last resort, setting `PYTHONIOENCODING=utf-8` can force Python to use UTF-8 for standard streams.
Upgrade
Version history
0.6.2latest on PyPI · released Jun 9, 2020
Audit
Dependencies
pastelrequiredUsed for terminal coloring; compatibility fixes were applied in v0.4.2.
pylevrequiredUsed for Levenshtein distance calculations, likely for fuzzy matching or suggestions in CLI.
Agent activity
19 hits · last 30 days
node
16
OpenAI (training)
1
Resources
clikit — pip install clikit · libregistry