{"id":21065,"library":"consolekit","title":"consolekit","description":"consolekit is a collection of utilities for Click, providing additional decorators, formatting helpers, and input/output features. Current version is 1.13.0, supports Python >=3.7. Actively maintained.","status":"active","version":"1.13.0","language":"python","source_language":"en","source_url":"https://github.com/domdfcoding/consolekit","tags":["click","cli","utilities","color","terminal"],"install":[{"cmd":"pip install consolekit","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"core dependency for CLI utilities","package":"click","optional":false},{"reason":"used for string and typing helpers","package":"domdf-python-tools","optional":false}],"imports":[{"note":"In versions >=1.0, top-level re-exports are available; using submodule paths may break in future.","wrong":"from consolekit.decorators import command","symbol":"command","correct":"from consolekit import command"},{"note":"VerboseCommand moved to top-level; direct submodule import deprecated.","wrong":"from consolekit.commands import VerboseCommand","symbol":"VerboseCommand","correct":"from consolekit import VerboseCommand"},{"note":"Colour is re-exported at package level in >=1.0.","wrong":"from consolekit.colour import Colour","symbol":"Colour","correct":"from consolekit import Colour"},{"note":"Screen class should be imported from top-level.","wrong":"from consolekit.screen import Screen","symbol":"Screen","correct":"from consolekit import Screen"}],"quickstart":{"code":"from consolekit import command, Colour\n\n@command()\ndef greet(name: str):\n    print(f\"{Colour.green('Hello')}, {name}!\")\n\nif __name__ == '__main__':\n    greet()","lang":"python","description":"Basic example: define a click command using consolekit's @command, use Colour for colored output."},"warnings":[{"fix":"Use from consolekit import command instead of from consolekit.decorators import command.","message":"In v1.0, many imports were reorganized. Symbols previously under submodules (e.g., consolekit.decorators.command) now must be imported from consolekit top-level. Direct submodule imports may break.","severity":"breaking","affected_versions":">=1.0.0,<2.0.0"},{"fix":"Import decorators from consolekit directly.","message":"The consolekit.decorators module is deprecated; all decorators are now re-exported from the main package.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Use consolekit.option consistently within a consolekit.command-decorated function.","message":"The @command decorator from consolekit expects the function to return a click.Command. If you mix consolekit.option with native click.option, argument ordering may differ.","severity":"gotcha","affected_versions":"all"},{"fix":"Call Colour.is_enabled() before applying colors or use Colour.strip() to remove colors.","message":"Colour class uses ANSI escape sequences; ensure the output stream supports colors (e.g., not redirected to a file). Use colour.is_enabled() to check.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Change 'from consolekit.decorators import command' to 'from consolekit import command'.","cause":"In consolekit >=1.0, the decorators submodule was removed; all decorators are now in the top-level package.","error":"ModuleNotFoundError: No module named 'consolekit.decorators'"},{"fix":"Upgrade consolekit to >=1.0: pip install --upgrade consolekit. Then use 'from consolekit import Colour'.","cause":"Attempting to import Colour from an older version where it was not re-exported top-level, or using a stale installation.","error":"AttributeError: module 'consolekit' has no attribute 'Colour'"},{"fix":"Use @command() with parentheses, and ensure the function logic returns None (not a Command object) unless you intend to customize the command.","cause":"The @command decorator is used without parentheses, or the decorated function is not returning a click.Command correctly.","error":"TypeError: 'Command' object is not callable"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}