{"id":3909,"library":"blessings","title":"Blessings","description":"Blessings is a thin, practical Python wrapper around terminal capabilities, offering an elegant interface for coloring, styling, and positioning text. It aims to simplify advanced terminal interactions compared to raw ANSI escape codes or the `curses` library, handling common cases like output redirection gracefully. The latest version, 1.7, was released in June 2018. The project is largely unmaintained, with active development continuing in a fork called `blessed`.","status":"maintenance","version":"1.7","language":"en","source_language":"en","source_url":"https://github.com/erikrose/blessings","tags":["terminal","cli","styling","colors","cursor","python2","python3"],"install":[{"cmd":"pip install blessings","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"symbol":"Terminal","correct":"from blessings import Terminal"}],"quickstart":{"code":"from blessings import Terminal\n\nterm = Terminal()\n\n# Basic styling\nprint(term.bold_red_on_yellow('Hello, Blessings!'))\n\n# Temporary cursor positioning\nwith term.location(x=0, y=term.height - 1):\n    print(term.underline('This text is at the bottom.'))\n\n# Clear the screen\n# print(term.clear)\n\n# Example of does_styling for graceful degradation\nif term.does_styling:\n    print(term.bold('Terminal supports styling!'))\nelse:\n    print('Terminal does not support styling, printing plain text.')","lang":"python","description":"Initialize the Terminal object and use its attributes for styling. The `location` context manager allows temporary cursor movements. Check `term.does_styling` for graceful degradation when output is piped to a non-terminal."},"warnings":[{"fix":"Consider migrating to the `blessed` library (`pip install blessed`) for continued support and new features, especially if targeting modern Python versions or Windows.","message":"The `blessings` library is largely unmaintained since its last release (v1.7 in 2018). Most active development and new features, including Python 3.7+ compatibility, Windows support, and improved keyboard handling, are found in the `blessed` fork (PyPI: `blessed`).","severity":"deprecated","affected_versions":"All versions (1.7 and earlier)"},{"fix":"On Windows, `blessings` needs to be used in conjunction with a library like `colorama` for native CMD support. The `blessed` fork (not `blessings`) offers native Windows support starting from its later versions.","message":"Blessings does not natively support color or styling on the Windows command prompt by itself. While it may work in some environments (like Cygwin, WSL), direct Windows CMD support is absent.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure you are running Blessings on a compatible Python version (>=2.7, excluding 3.0-3.3, and older Python 3.x versions up to 3.6 for Blessings 1.7). For Python 3.7+, you should use the `blessed` library instead.","message":"Blessings is explicitly incompatible with specific Python 3 versions (3.0, 3.1, 3.2, 3.3).","severity":"breaking","affected_versions":"All versions, specifically when run on Python 3.0-3.3"},{"fix":"For comprehensive keyboard input, including arrow keys and special characters, you would need to use `curses` directly or consider the `blessed` fork, which specifically added enhanced keyboard input capabilities.","message":"The original `blessings` library does not provide robust character-by-character keyboard input handling, which is a common requirement for interactive terminal applications. Users often expect this functionality similar to `curses`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Pass `force_styling=True` to the `Terminal` constructor: `term = Terminal(force_styling=True)`. Alternatively, check `term.does_styling` to conditionally apply formatting.","message":"When output is redirected (e.g., to a file or pipe), `blessings` intelligently omits terminal control codes by default. If you intend to pipe output to a program that *can* handle escape sequences (like `less -r`), this automatic omission might be undesired.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Use the callable form: `print(term.bold('text'))`. This automatically applies the style and resets it afterward, reducing boilerplate and potential errors.","message":"While string concatenation (e.g., `term.bold + 'text' + term.normal`) works for applying styles, it requires manual resetting with `term.normal`. For simpler usage, attributes can be called directly.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}