{"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":"en","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,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}