Registry / http-networking / blessings

blessings

JSON →
library1.7pypypi✓ verified 24d ago

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`.

pip install blessings
INSTALL
IMPORT
SIG · BLESSINGS
B
blessings
http-networkingpythonv1.7
Install
1.6s avg
Import
22ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.7 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.026s · 18MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.018s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Terminal
from blessings import Terminal

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.

from blessings import Terminal term = Terminal() # Basic styling print(term.bold_red_on_yellow('Hello, Blessings!')) # Temporary cursor positioning with term.location(x=0, y=term.height - 1): print(term.underline('This text is at the bottom.')) # Clear the screen # print(term.clear) # Example of does_styling for graceful degradation if term.does_styling: print(term.bold('Terminal supports styling!')) else: print('Terminal does not support styling, printing plain text.')
Debug
Known issues
deprecatedThe `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`).
fix
Consider migrating to the `blessed` library (`pip install blessed`) for continued support and new features, especially if targeting modern Python versions or Windows.
affects: All versions (1.7 and earlier)
gotchaBlessings 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.
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.
affects: All versions
breakingBlessings is explicitly incompatible with specific Python 3 versions (3.0, 3.1, 3.2, 3.3).
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.
affects: All versions, specifically when run on Python 3.0-3.3
gotchaThe 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`.
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.
affects: All versions
gotchaWhen 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.
fix
Pass `force_styling=True` to the `Terminal` constructor: `term = Terminal(force_styling=True)`. Alternatively, check `term.does_styling` to conditionally apply formatting.
affects: All versions
gotchaWhile 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.
fix
Use the callable form: `print(term.bold('text'))`. This automatically applies the style and resets it afterward, reducing boilerplate and potential errors.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'blessings'
The 'blessings' library is not installed in your Python environment.
fix
Run `pip install blessings` in your terminal to install the library.
ModuleNotFoundError: No module named '_curses'
The `blessings` library relies on the `curses` module, which is a Unix-specific library and is not available by default on Windows.
fix
On Windows, install the `windows-curses` package: `pip install windows-curses`. For other operating systems, ensure your system has `ncurses` development libraries installed (e.g., `libncurses-dev` on Debian/Ubuntu, `ncurses-devel` on Fedora/RHEL).
_curses.error: setupterm: could not find terminal
The `curses` library (used by `blessings`) cannot determine your terminal type because the `TERM` environment variable is either unset or set to an unrecognized value. This often happens in non-interactive environments, some IDEs, or over SSH without proper terminal forwarding.
fix
Ensure the `TERM` environment variable is set to a valid terminal type (e.g., `xterm`, `xterm-256color`, `screen`). You can set it in your shell before running the Python script: `export TERM=xterm`.
TERM environment variable not set
The `TERM` environment variable, which specifies the type of terminal you are using, is not defined. This is a prerequisite for terminal-aware applications like those using `blessings`.
fix
Set the `TERM` environment variable to an appropriate value for your terminal. For example, in Bash or Zsh, use `export TERM=xterm` or `export TERM=xterm-256color`. Add this to your shell's configuration file (e.g., `~/.bashrc`, `~/.zshrc`) to make it permanent.
Upgrade
Version history
1.7latest on PyPI · released Jun 21, 2018
Audit
Dependencies

No dependency data recorded yet.

Agent activity
23 hits · last 30 days
node
20
Amazon
1
OpenAI (training)
1
Resources