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 clikitVerified import paths — ran on the pinned version, not inferred.
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.
Review any custom event listeners or code interacting with internal event name structures and update them to conform to the new pattern.
If faster progress bar updates are required, configure the update rate using the `min_seconds_between_redraws()` method on the progress bar instance.
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`.
Ensure you are using `clikit` v0.4.2 or newer with compatible versions of `pastel` to avoid rendering or display issues.
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.
Install the 'clikit' package using pip: `pip install clikit` or if using Poetry, add it to your project dependencies: `poetry add clikit`.
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.
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.