{"id":4477,"library":"clikit","title":"CliKit","description":"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.","status":"maintenance","version":"0.6.2","language":"python","source_language":"en","source_url":"https://github.com/sdispater/clikit","tags":["cli","command-line","toolkit","console"],"install":[{"cmd":"pip install clikit","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Used for terminal coloring; compatibility fixes were applied in v0.4.2.","package":"pastel"},{"reason":"Used for Levenshtein distance calculations, likely for fuzzy matching or suggestions in CLI.","package":"pylev"}],"imports":[{"symbol":"Application","correct":"from clikit.api.application import Application"},{"symbol":"Command","correct":"from clikit.api.command import Command"},{"symbol":"Argument","correct":"from clikit.api.args import Argument"},{"symbol":"Option","correct":"from clikit.api.args import Option"},{"note":"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.","wrong":"from clikit.ui.output import Output","symbol":"IO","correct":"from clikit.ui.io import IO"}],"quickstart":{"code":"from clikit.api.application import Application\nfrom clikit.api.command import Command\nfrom clikit.api.args import Argument, Option\nfrom clikit.ui.io import IO\n\n\nclass HelloCommand(Command):\n    def __init__(self):\n        super().__init__()\n        self.set_name(\"hello\")\n        self.set_description(\"Greets the given name.\")\n        self.add_argument(Argument(\"name\", Argument.REQUIRED, \"The name to greet.\"))\n        self.add_option(Option(\"loud\", \"l\", Option.NO_VALUE, \"Make the greeting loud.\"))\n\n    def handle(self, io: IO):\n        name = io.args.get(\"name\")\n        loud = io.args.get(\"loud\")\n\n        message = f\"Hello, {name}!\"\n        if loud:\n            message = message.upper()\n\n        io.write_line(message)\n\n\nif __name__ == \"__main__\":\n    application = Application(\"My CLI App\", \"1.0.0\")\n    application.add_command(HelloCommand())\n    application.run()","lang":"python","description":"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."},"warnings":[{"fix":"Review any custom event listeners or code interacting with internal event name structures and update them to conform to the new pattern.","message":"Version 0.4.0 introduced changes to how event names are stored and exposed.","severity":"breaking","affected_versions":">=0.4.0"},{"fix":"If faster progress bar updates are required, configure the update rate using the `min_seconds_between_redraws()` method on the progress bar instance.","message":"Default progress bar update rate was limited to a maximum of every 100ms in v0.6.1.","severity":"gotcha","affected_versions":">=0.6.1"},{"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`.","message":"Progress bars and indicators passed an `IO` instance will now default to using the error output stream (`stderr`) instead of standard output (`stdout`).","severity":"gotcha","affected_versions":">=0.6.1"},{"fix":"Ensure you are using `clikit` v0.4.2 or newer with compatible versions of `pastel` to avoid rendering or display issues.","message":"Compatibility with the `pastel` dependency was a known issue that required fixes in v0.4.2.","severity":"gotcha","affected_versions":"<0.4.2"},{"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.","message":"Early 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.","severity":"gotcha","affected_versions":"<0.5.0"}],"env_vars":null,"search_vec":"'0.6.2':39 '2019':59 '2020':46,62 'activ':55 'build':13 'cleo':32 'cli':29,63 'clikit':1,2 'collect':9 'command':18,65 'command-lin':17,64 'compon':26 'consol':68 'current':36 'develop':56 'earli':61 'follow':51 'foundat':25 'framework':30 'indic':47 'interfac':20 'june':45 'last':42 'late':58 'librari':6,34 'like':31 'line':19,66 'mainten':49 'period':53 'phase':50 'provid':7 'python':5 'releas':43 'robust':14 'serv':22 'testabl':16 'toolkit':67 'util':11 'version':38","created_at":"2026-04-12T13:54:19.980694+00:00","updated_at":"2026-04-16T14:23:34.186264+00:00","problems":[{"fix":"Install the 'clikit' package using pip: `pip install clikit` or if using Poetry, add it to your project dependencies: `poetry add clikit`.","cause":"This error occurs when the 'clikit' package is not installed in the Python environment or is not accessible within the current project's dependencies.","error":"ModuleNotFoundError: No module named 'clikit'"},{"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.","cause":"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.","error":"NoSuchOptionException The \"-<option_name>\" option does not exist."},{"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.","cause":"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.","error":"UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.6.2","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/sdispater/clikit","docs":null,"changelog":null,"pypi":"https://pypi.org/project/clikit/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-29","next_check":"2026-07-28","install_tag":null}}