inform

raw JSON →
1.36 verified Sat May 09 auth: no python

A Python library for print and logging utilities that provide colorized, formatted output and progress indicators. Current version is 1.36. Released roughly once or twice a year.

pip install inform
error AttributeError: module 'inform' has no attribute 'inform'
cause Trying to import inform as a class or function instead of a module.
fix
Use 'import inform' and then call inform.log() etc.
error TypeError: 'module' object is not callable
cause Calling inform() directly instead of inform.log().
fix
Use inform.log() or inform.warn() instead of inform().
gotcha inform.log() writes to stderr, not stdout. Many users expect stdout.
fix Use Python's print() for stdout; inform is for user-facing messages that should go to stderr.
gotcha inform does not use Python's logging module; it has its own output system. Do not try to configure it with logging.basicConfig.
fix Use inform's own settings (e.g., inform.Config) to adjust output behavior.
gotcha inform.Progress is a context manager that requires a 'with' statement. Calling it without 'with' will not work as expected.
fix Use 'with inform.Progress() as progress:' to create a progress indicator.

Basic usage: log, warn, and fail functions output colorized messages to stderr.

import inform

inform.log('Hello, world!')
inform.warn('This is a warning.')
inform.fail('This is an error.')