Frequently Asked Questions
Why is Enlighten called Enlighten?
A progress bar's purpose is to inform the user about an ongoing process. Enlighten, meaning "to inform", seems a fitting name. (Plus any names related to progress were already taken)
Is Windows supported?
Enlighten has supported Windows since version 1.3.0.
Windows does not currently support resizing.
Enlighten also works in Linux-like subsystems for Windows such as Cygwin or Windows Subsystem for Linux.
Is Jupyter Notebooks Supported?
Support for Jupyter notebooks was added in version 1.10.0.
Jupyter Notebook support is provide by the NotebookManager
class.
If running inside a Jupyter Notebook, get_manager()
will return a
NotebookManager
instance.
There is currently no support for detecting the width of a Jupyter notebook so output width has been
set statically to 100 characters. This can be overridden by passing the width
keyword argument
to get_manager()
.
Is PyCharm supported?
PyCharm uses multiple consoles and the behavior differs depending on how the code is called.
Enlighten works natively in the PyCharm command terminal.
To use Enlighten with Run or Debug, terminal emulation must be enabled. Navigate to Run -> Edit Configurations -> Templates -> Python and select Emulate terminal in output console.
The PyCharm Python console is currently not supported because sys.stdout
does not reference a valid TTY.
We are also tracking an issue with CSR in the PyCharm terminal.
Can you add support for _______ terminal?
We are happy to add support for as many terminals as we can. However, not all terminals can be supported. There a few requirements.
The terminal must be detectable programmatically
We need to be able to identify the terminal in some reasonable way and differentiate it from other terminals. This could be through environment variables, the
platform
module, or some other method.A subset of terminal codes must be supported
While these codes may vary among terminals, the capability must be provided and activated by printing a terminal sequence. The required codes are listed below.
move / CUP - Cursor Position
hide_cursor / DECTCEM - Text Cursor Enable Mode
show_cursor / DECTCEM - Text Cursor Enable Mode
csr / DECSTBM - Set Top and Bottom Margins
clear_eos / ED - Erase in Display
clear_eol / EL - Erase in Line
feed / CUD - Cursor Down (Or scroll with linefeed)
Terminal dimensions must be detectable
The height and width of the terminal must be available to the running process.
Why does RuntimeError: reentrant call
get raised sometimes during a resize?
This is caused when another thread or process is writing to a standard stream (STDOUT, STDERR) at the same time the resize signal handler is writing to the stream.
Enlighten tries to detect when a program is threaded or running multiple processes and defer resize handling until the next normal write event. However, this condition is evaluated when the scroll area is set, typically when the first counter is added. If no threads or processes are detected at that time, and the value of threaded was not set explicitly, resize events will not be deferred.
In order to guarantee resize handling is deferred, it is best to pass threaded=True
when
creating a manager instance.
Why isn't my progress bar displayed until update()
is called?
Progress bars and counters are not automatically drawn when created because some fields may be
missing if subcounters are used. To force the counter to draw before updating, call
refresh()