Enlighten Progress Bar is a console progress bar library for Python.

Overview
Documentation Status Travis-CI Build Status Coverage Status
Linux supported Windows supported MacOS supported BSD supported
PyPI Package latest release Supported versions Supported implementations
Latest Fedora Version Latest EPEL Version Latest Arch Linux Version Latest Debian Version Latest Ubuntu Version Latest Conda Forge Version

Overview

Enlighten Progress Bar is a console progress bar library for Python.

The main advantage of Enlighten is it allows writing to stdout and stderr without any redirection or additional code. Just print or log as you normally would.

Enlighten also includes experimental support for Jupyter Notebooks.


https://raw.githubusercontent.com/Rockhopper-Technologies/enlighten/master/doc/_static/demo.gif

The code for this animation can be found in demo.py in examples.

Documentation

https://python-enlighten.readthedocs.io

Installation

PIP

$ pip install enlighten

RPM

Fedora and EL8 (RHEL/CentOS)

(EPEL repositories must be configured for EL8)

$ dnf install python3-enlighten

EL7 (RHEL/CentOS)

(EPEL repositories must be configured)

$ yum install python2-enlighten
$ yum install python36-enlighten

PKG

Arch Linux

$ pacman -S python-enlighten

DEB

Debian and Ubuntu

$ apt-get install python3-enlighten

Conda

$ conda install -c conda-forge enlighten

Examples

Basic

For a basic status bar, invoke the Counter class directly.

import time
import enlighten

pbar = enlighten.Counter(total=100, desc='Basic', unit='ticks')
for num in range(100):
    time.sleep(0.1)  # Simulate work
    pbar.update()

Advanced

To maintain multiple progress bars simultaneously or write to the console, a manager is required.

Advanced output will only work when the output stream, sys.stdout by default, is attached to a TTY. get_manager can be used to get a manager instance. It will return a disabled Manager instance if the stream is not attached to a TTY and an enabled instance if it is.

import time
import enlighten

manager = enlighten.get_manager()
ticks = manager.counter(total=100, desc='Ticks', unit='ticks')
tocks = manager.counter(total=20, desc='Tocks', unit='tocks')

for num in range(100):
    time.sleep(0.1)  # Simulate work
    print(num)
    ticks.update()
    if not num % 5:
        tocks.update()

manager.stop()

Counters

The Counter class has two output formats, progress bar and counter.

The progress bar format is used when a total is not None and the count is less than the total. If neither of these conditions are met, the counter format is used:

import time
import enlighten

counter = enlighten.Counter(desc='Basic', unit='ticks')
for num in range(100):
    time.sleep(0.1)  # Simulate work
    counter.update()

Additional Examples

Customization

Enlighten is highly configurable. For information on modifying the output, see the Series and Format sections of the Counter documentation.

Comments
  • Some printed lines lost when resizing the terminal

    Some printed lines lost when resizing the terminal

    Describe the bug Resizing the terminal emulator may cause printed lines to be lost.

    To Reproduce Change the height of the terminal while the following program is running:

    import sys
    import time
    
    import enlighten
    
    with enlighten.get_manager() as manager:
        with manager.counter(total=30) as counter:
            for i in range(30):
                time.sleep(1)
                print(i)
                counter.update()
    

    Environment (please complete the following information):

    • Enlighten Version: 1.6.2
    • OS and version: Debian 10
    • Console application: GNOME Terminal 3.30.2 using VTE 0.54.2 +GNUTLS
    • Special Conditions: N/A

    Additional context The same problem happens with tmux and other terminal emulators.

    bug 
    opened by joreiff 19
  • enlighten for Windows

    enlighten for Windows

    Hi !

    This will probably be more an information than an issue: On Windows, the module does not working well. I've tried the following default below code:

    import time
    import enlighten
    
    manager = enlighten.get_manager()
    ticks = manager.counter(total=100, desc='Ticks', unit='ticks')
    tocks = manager.counter(total=20, desc='Tocks', unit='tocks')
    
    for num in range(100):
        time.sleep(0.1)  # Simulate work
        print(num)
        ticks.update()
        if not num % 5:
            tocks.update()
    
    manager.stop()
    

    And it looks like it does not working on Windows:

    image

    I also had the following error message:

    C:....\lib\site-packages\blessed\terminal.py:32: UserWarning: One or more of the modules: 'termios', 'fcntl', and 'tty' are not found on your platform 'win32'. The following methods of Terminal are dummy/no-op unless a deriving class overrides them: setraw, cbreak, kbhit, height, width warnings.warn(_MSG_NOSUPPORT)

    I'm not sure if termios, fcntl and tty are mandatory, however termios is only available on Linux...

    Feature Request 
    opened by toshiro92 19
  • OSError: [WinError 6] The handle is invalid.

    OSError: [WinError 6] The handle is invalid.

    This error happens for all examples on the first page, as this one:

    import time
    import enlighten
    
    manager = enlighten.get_manager()
    ticks = manager.counter(total=100, desc='Ticks', unit='ticks')
    tocks = manager.counter(total=20, desc='Tocks', unit='tocks')
    
    for num in range(100):
        time.sleep(0.1)  # Simulate work
        print(num)
        ticks.update()
        if not num % 5:
            tocks.update()
    
    manager.stop()
    

    python3 version 3.7.2, Windows 10

    Traceback (most recent call last):
      File "D:\User\Downloads\text2.py", line 4, in <module>
        manager = enlighten.get_manager()
      File "F:\Python\lib\site-packages\enlighten\_manager.py", line 397, in get_manager
        return Manager(stream=stream, counterclass=counterclass, **kwargs)
      File "F:\Python\lib\site-packages\enlighten\_manager.py", line 78, in __init__
        self.term = Terminal(stream=self.stream)
      File "F:\Python\lib\site-packages\enlighten\_terminal.py", line 32, in __init__
        super(Terminal, self).__init__(*args, **kwargs)
      File "F:\Python\lib\site-packages\enlighten\_win_terminal.py", line 144, in __init__
        enable_vt_mode(self.stream_fh)
      File "F:\Python\lib\site-packages\enlighten\_win_terminal.py", line 109, in enable_vt_mode
        KERNEL32.GetConsoleMode(filehandle, ctypes.byref(current_mode))
      File "F:\Python\lib\site-packages\enlighten\_win_terminal.py", line 71, in _check_bool
        raise ctypes.WinError(ctypes.get_last_error())
    OSError: [WinError 6] The handle is invalid.
    
    opened by evandrocoan 16
  • "OSError: [WinError 0] The operation completed successfully." (PyCharm, Windows)

    Describe the bug Hey, first, thanks a lot for enlighten, I love the ideas you have put into it! :)

    I have the problem that a call to get_manager() will lead to the following error in my PyCharm console output WITH terminal emulation on Windows:

    Traceback (most recent call last): File "C:\Users\jschoena\AppData\Roaming\JetBrains\PyCharm2022.1\scratches\Test enlighten.py", line 4, in enlighten_manager = enlighten.get_manager(stream=sys.stdout, companion_stream=sys.stderr) File "C:\Users\jschoena.conda\envs\main\lib\site-packages\enlighten\manager.py", line 55, in get_manager return Manager(stream=stream, counter_class=counter_class, **kwargs) File "C:\Users\jschoena.conda\envs\main\lib\site-packages\enlighten_manager.py", line 70, in init super(Manager, self).init(**kwargs) File "C:\Users\jschoena.conda\envs\main\lib\site-packages\enlighten_basemanager.py", line 74, in init self.term = Terminal(stream=self.stream, kind=kind, force_styling=bool(kind)) File "C:\Users\jschoena.conda\envs\main\lib\site-packages\blessed\terminal.py", line 208, in init self.__init__keycodes() File "C:\Users\jschoena.conda\envs\main\lib\site-packages\blessed\terminal.py", line 331, in __init__keycodes self._encoding = get_console_input_encoding()
    File "C:\Users\jschoena.conda\envs\main\lib\site-packages\jinxed\win32.py", line 140, in get_console_input_encoding encoding = 'cp%d' % KERNEL32.GetConsoleCP() File "C:\Users\jschoena.conda\envs\main\lib\site-packages\jinxed\win32.py", line 86, in _check_bool raise ctypes.WinError(ctypes.get_last_error()) OSError: [WinError 0] The operation completed successfully.

    Process finished with exit code 1

    Even if I would catch the exception, the enlighten manager object is not created, thus I cannot continue from here.

    To Reproduce This snippet is enough:

    import enlighten
    
    enlighten_manager = enlighten.get_manager()
    
    print("Doesn't arrive here!")
    

    Environment:

    • Enlighten Version: 1.10.2 pyhd8ed1ab_0 conda-forge
    • OS and version: Windows Server 2019 Standard, 1809, OS build 17763.2803
    • Console application: PyCharm 2022.1, "Emulate terminal in output console" checked
    • Special Conditions: None, just executing script within IDE
    • Related packages:
      • blessed 1.19.1 py310h5588dad_1 conda-forge
      • python 3.10.4 hbb2ffb3_0 defaults
      • jinxed 1.1.0 py310h5588dad_2 conda-forge
    bug 
    opened by Jonibhoni 15
  • Sub-counters not available in counter_format

    Sub-counters not available in counter_format

    I would really like to display some other statistics/counters when in counter mode. It seems like the only way to do this is using sub-counters, but if I try to access a sub-counter in a counter_format, I get an error such as:

    KeyError: 'count_1'
    
    Feature Request 
    opened by edmcman 15
  • locale.Error: unsupported locale setting

    locale.Error: unsupported locale setting

    Not sure if it is related to the enlighten itself or the error is somewhere else, but I am receiving the following error:

    Traceback (most recent call last):
      File "bm_experiments/bm_DROP2.py", line 228, in <module>
        arg_params, path_expt = BmDROP2.main()
      File "~/Repos/BIRL/birl/benchmark.py", line 632, in main
        benchmark.run()
      File "~/Repos/BIRL/birl/utilities/experiments.py", line 139, in run
        self._run()
      File "~/Repos/BIRL/birl/benchmark.py", line 299, in _run
        aggr_experiments=True)
      File "~/Repos/BIRL/birl/benchmark.py", line 318, in __execute_method
        for res in iterate_mproc_map(method, iter_table, nb_workers=nb_workers, desc=desc):
      File "~/Repos/BIRL/birl/utilities/experiments.py", line 547, in iterate_mproc_map
        stream=sys.stderr)
      File "~/TEMP/Applications/vEnv3.6/lib/python3.6/site-packages/enlighten/counter.py", line 31, in __init__
        counter_class=self.__class__, set_scroll=False)
      File "~/TEMP/Applications/vEnv3.6/lib/python3.6/site-packages/enlighten/_manager.py", line 401, in get_manager
        return Manager(stream=stream, counterclass=counterclass, **kwargs)
      File "~/TEMP/Applications/vEnv3.6/lib/python3.6/site-packages/enlighten/_manager.py", line 78, in __init__
        self.term = Terminal(stream=self.stream)
      File "~/TEMP/Applications/vEnv3.6/lib/python3.6/site-packages/enlighten/_terminal.py", line 26, in __init__
        super(Terminal, self).__init__(*args, **kwargs)
      File "~/TEMP/Applications/vEnv3.6/lib/python3.6/site-packages/blessed/terminal.py", line 238, in __init__
        self.__init__keycodes()
      File "~/TEMP/Applications/vEnv3.6/lib/python3.6/site-packages/blessed/terminal.py", line 300, in __init__keycodes
        locale.setlocale(locale.LC_ALL, '')
      File "~/TEMP/Applications/vEnv3.6/lib/python3.6/locale.py", line 598, in setlocale
        return _setlocale(category, locale)
    locale.Error: unsupported locale setting
    

    Running on the following machine:

    • posix.uname_result(sysname='Linux', nodename='cmpgrid-68', release='4.9.0-6-amd64', version='#1 SMP Debian 4.9.82-1+deb9u3 (2018-03-02)', machine='x86_64')
    • Python 3.6.6 (default, Mar 11 2019, 11:55:52) [GCC 7.3.0] on linux
    • pip 19.2.1 from /home.dokt/borovji3/TEMP/Applications/vEnv3.6/lib/python3.6/site-packages/pip (python 3.6)
    • enlighten==1.4.0
    Not a Bug 
    opened by Borda 13
  • Fix / Support for Screen ?

    Fix / Support for Screen ?

    I use screen to launch long running programs over SSH, and when I discovered Enlighten I figured it would be really cool to use it to monitor the running process.
    Unfortunately it seems enlighten doesn't like screen too much (or is it the terminal? sorry I'm new to the terminal world).

    • The loading character doesn't seem to be recognized
    • I use two progress bar, but the second one seems to multiply everytime it restarts to 0.

    image

    I don't know if it's relevant, but the program is running on a Debian 10 on a screen.xterm-256color terminal, to which I'm connected via SSH in a WSL environment using Windows Terminal.
    However everything looks nice in the same environment/terminal when I run it locally.

    Concerning the support requirements :

    • The terminal must be detectable programmatically echo $STY

    • Cursor movements I would guess that that comes from Xterm ?

    • Terminal dimensions tput cols / rows seems to work, not sure if that's enough.

    Tell me if I missed anything ;) thanks for you awesome work btw!

    Not a Bug 
    opened by GChalony 12
  • Invalid handle in PyCharm (Windows)

    Invalid handle in PyCharm (Windows)

    Hi, I am running enlighten-1.3.3 on Windows under Pycharm, and I always get a OSError: [WinError 6] The handle is invalid. error when I try to instantiate either a Counter or a Manager. I see there were similar issues raised here and here but if I understood correctly they should be fixed in this version.

    Did I misunderstand the other issues and is Pycharm simply not supported by enlighten? Or is there some way to fix this issue? Thanks

    opened by 4sfaloth 12
  • Human Readable Unit multipliers

    Human Readable Unit multipliers

    Is your feature request related to a problem? Please describe. For handling data, making the units able to be auto formatted as E/P/T/G/M/K{unit}ps would be awesome and improve human readability

    I'm not sure if this is best achieved by code that changes the units on the fly, but being able to mix units would also be reuqired, e.g. if using bytes, MB/s for speed and K/G/T/PM/s for size / total transfered - also being able to specify how many decimal places would be useful when formatting. For example 3.22GB/10.23TB 170MB/s, is there a way to easily do this or a way to add custom fields that use a callback and the callback gets passed the current data to be formatted?

    I thought about using custom fields but that would mean a lot of additional messy work.

    thoughts?

    Feature Request 
    opened by lps-rocks 11
  • Crash during window resizing

    Crash during window resizing

    Describe the bug When resizing the window the thread running enlighten crashes

    To Reproduce Resize window while running with multiple threads

    Environment (please complete the following information):

    • Enlighten Version: 1.6.0
    • OS and version: Debian 10 running Python 3.7.3
    • Console application: Terminal (mac) via SSH connection inside SCREEN
    • Special Conditions: None

    Additional context

    Traceback (most recent call last):
      File "/usr/local/lib/python3.7/dist-packages/enlighten/_manager.py", line 275, in _resize_handler
        assert self.resize_lock
    AssertionError
    During handling of the above exception, another exception occurred:
    Traceback (most recent call last):
      File "./archive.py", line 633, in <module>
        status[r[0]].refresh()
      File "/usr/local/lib/python3.7/dist-packages/enlighten/_basecounter.py", line 230, in refresh
        flush=flush, counter=self)
      File "/usr/local/lib/python3.7/dist-packages/enlighten/_manager.py", line 472, in write
        stream.write(u'\r' + term.clear_eol + output)
      File "/usr/local/lib/python3.7/dist-packages/enlighten/_manager.py", line 303, in _resize_handler
        cter.refresh(flush=False)
      File "/usr/local/lib/python3.7/dist-packages/enlighten/_basecounter.py", line 230, in refresh
        flush=flush, counter=self)
      File "/usr/local/lib/python3.7/dist-packages/enlighten/_manager.py", line 472, in write
        stream.write(u'\r' + term.clear_eol + output)
    RuntimeError: reentrant call inside <_io.BufferedWriter name='<stdout>'>
    bug 
    opened by lps-rocks 11
  • 9 tests fail

    9 tests fail

    Describe the bug

    
    ========================================================================================== FAILURES ==========================================================================================
    ___________________________________________________________________________________ TestManager.test_init ____________________________________________________________________________________
    
    self = <tests.test_manager.TestManager testMethod=test_init>
    
        @unittest.skipIf(STDOUT_NO_FD, 'No file descriptor for stdout')
        def test_init(self):
            # Companion stream is __stderr__ if stream is __stdout__
        
            # Need to mock isatty() for some build and test environments
            with mock.patch.object(sys, '__stderr__') as mock_stderr:
                mock_stderr.isatty.return_value = True
                manager = enlighten.Manager(stream=sys.__stdout__)
        
    >       self.assertIs(manager.stream, sys.stdout)
    E       AssertionError: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'> is not <_io.TextIOWrapper name="<_io.FileIO name=6 mode='rb+' closefd=True>" mode='r+' encoding='utf-8'>
    
    tests/test_manager.py:55: AssertionError
    ___________________________________________________________________________________ TestManager.test_repr ____________________________________________________________________________________
    
    self = <tests.test_manager.TestManager testMethod=test_repr>
    
        def test_repr(self):
            manager = enlighten.Manager()
    >       self.assertEqual(repr(manager), "Manager(stream=%r)" % sys.stdout)
    E       AssertionError: "Manager(stream=<_io.TextIOWrapper name='[33 chars]8'>)" != 'Manager(stream=<_io.TextIOWrapper name="[75 chars]\'>)'
    E       - Manager(stream=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)
    E       + Manager(stream=<_io.TextIOWrapper name="<_io.FileIO name=6 mode='rb+' closefd=True>" mode='r+' encoding='utf-8'>)
    
    tests/test_manager.py:139: AssertionError
    __________________________________________________________________________ TestHTMLConverter.test_class_not_unique ___________________________________________________________________________
    
    self = <tests.test_util.TestHTMLConverter testMethod=test_class_not_unique>
    
        def test_class_not_unique(self):
            """Repeated classes are dropped within the same span"""
        
    >       out = self.converter.to_html(self.term.blue_on_aquamarine(self.term.blue('blue_on_aquam')))
    
    tests/test_util.py:247: 
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    enlighten/_util.py:268: in to_html
        normal[1:] == [val[0] for val in parsed.lookahead(0, self.normal_rem or None)]:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    
    .0 = <tuple_iterator object at 0x912d98130>
    
    >   normal[1:] == [val[0] for val in parsed.lookahead(0, self.normal_rem or None)]:
    E   TypeError: 'Termcap' object is not subscriptable
    
    enlighten/_util.py:268: TypeError
    ________________________________________________________________________________ TestHTMLConverter.test_color ________________________________________________________________________________
    
    self = <tests.test_util.TestHTMLConverter testMethod=test_color>
    
        def test_color(self):
            """Verify color conversion"""
        
            # CGA color on RGB color
    >       out = self.converter.to_html(self.term.blue_on_aquamarine('blue_on_aquam'))
    
    tests/test_util.py:117: 
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    enlighten/_util.py:268: in to_html
        normal[1:] == [val[0] for val in parsed.lookahead(0, self.normal_rem or None)]:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    
    self = <enlighten._util.Lookahead object at 0x918b28b50>, start = 0, stop = None
    
        def lookahead(self, start, stop=None):
            """
            Args:
                start(int): Positive integer index of first value
                stop(int): Positive integer index to end before (not returned)
        
            Retrieve next value(s) in iterator.
        
            start and stop roughly behave like slice notation, but must be positive
            """
        
            last = max(start, (stop or 0) - 1)
        
            while last >= len(self.buffer):
                try:
                    self.buffer.append(next(self.iterator))
                except StopIteration:
                    break
        
    >       return self.buffer[start] if stop is None else self.buffer[start:stop]
    E       IndexError: list index out of range
    
    enlighten/_util.py:163: IndexError
    _____________________________________________________________________________ TestHTMLConverter.test_empty_span ______________________________________________________________________________
    
    self = <tests.test_util.TestHTMLConverter testMethod=test_empty_span>
    
        def test_empty_span(self):
            """Empty Spans are ignored"""
        
    >       out = self.converter.to_html(self.term.underline('') + 'empty')
    
    tests/test_util.py:241: 
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    enlighten/_util.py:268: in to_html
        normal[1:] == [val[0] for val in parsed.lookahead(0, self.normal_rem or None)]:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    
    .0 = <tuple_iterator object at 0x9191f39d0>
    
    >   normal[1:] == [val[0] for val in parsed.lookahead(0, self.normal_rem or None)]:
    E   TypeError: 'NoneType' object is not subscriptable
    
    enlighten/_util.py:268: TypeError
    ________________________________________________________________________________ TestHTMLConverter.test_style ________________________________________________________________________________
    
    self = <tests.test_util.TestHTMLConverter testMethod=test_style>
    
        def test_style(self):
            """Verify style conversion"""
        
            # Italics
    >       out = self.converter.to_html(self.term.italic('italic'))
    
    tests/test_util.py:183: 
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    enlighten/_util.py:268: in to_html
        normal[1:] == [val[0] for val in parsed.lookahead(0, self.normal_rem or None)]:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    
    self = <enlighten._util.Lookahead object at 0x913854b50>, start = 0, stop = None
    
        def lookahead(self, start, stop=None):
            """
            Args:
                start(int): Positive integer index of first value
                stop(int): Positive integer index to end before (not returned)
        
            Retrieve next value(s) in iterator.
        
            start and stop roughly behave like slice notation, but must be positive
            """
        
            last = max(start, (stop or 0) - 1)
        
            while last >= len(self.buffer):
                try:
                    self.buffer.append(next(self.iterator))
                except StopIteration:
                    break
        
    >       return self.buffer[start] if stop is None else self.buffer[start:stop]
    E       IndexError: list index out of range
    
    enlighten/_util.py:163: IndexError
    ____________________________________________________________________________ TestHTMLConverter.test_style_output _____________________________________________________________________________
    
    self = <tests.test_util.TestHTMLConverter testMethod=test_style_output>
    
        def test_style_output(self):
            """Verify style section output"""
        
    >       out = self.converter.to_html(self.term.red_on_slategrey('red_on_slategrey'))
    
    tests/test_util.py:256: 
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    enlighten/_util.py:268: in to_html
        normal[1:] == [val[0] for val in parsed.lookahead(0, self.normal_rem or None)]:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    
    self = <enlighten._util.Lookahead object at 0x9191f3100>, start = 0, stop = None
    
        def lookahead(self, start, stop=None):
            """
            Args:
                start(int): Positive integer index of first value
                stop(int): Positive integer index to end before (not returned)
        
            Retrieve next value(s) in iterator.
        
            start and stop roughly behave like slice notation, but must be positive
            """
        
            last = max(start, (stop or 0) - 1)
        
            while last >= len(self.buffer):
                try:
                    self.buffer.append(next(self.iterator))
                except StopIteration:
                    break
        
    >       return self.buffer[start] if stop is None else self.buffer[start:stop]
    E       IndexError: list index out of range
    
    enlighten/_util.py:163: IndexError
    _______________________________________________________________________ TestHTMLConverter.test_style_output_additional _______________________________________________________________________
    
    self = <tests.test_util.TestHTMLConverter testMethod=test_style_output_additional>
    
        def test_style_output_additional(self):
            """Verify style section output with additional sections"""
        
            out = self.converter.to_html(self.term.blink('blink'))
    >       self.assertEqual(out, '<pre><span class="enlighten-blink">blink</span></pre>')
    E       AssertionError: '<pre>blink</pre>' != '<pre><span class="enlighten-blink">blink</span></pre>'
    E       - <pre>blink</pre>
    E       + <pre><span class="enlighten-blink">blink</span></pre>
    
    tests/test_util.py:280: AssertionError
    _____________________________________________________________________________ TestHTMLConverter.test_unsupported _____________________________________________________________________________
    
    self = <tests.test_util.TestHTMLConverter testMethod=test_unsupported>
    
        def test_unsupported(self):
            """Verify unsupported does not produce classes"""
        
            # Unsupported capability
            out = self.converter.to_html(self.term.move(5, 6) + 'unsupported_move')
            self.assertEqual(out, '<pre>unsupported_move</pre>')
        
            # Unsupported text attribute
    >       out = self.converter.to_html(self.term.reverse('unsupported_reverse'))
    
    tests/test_util.py:224: 
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    enlighten/_util.py:268: in to_html
        normal[1:] == [val[0] for val in parsed.lookahead(0, self.normal_rem or None)]:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
    
    self = <enlighten._util.Lookahead object at 0x915b77850>, start = 0, stop = None
    
        def lookahead(self, start, stop=None):
            """
            Args:
                start(int): Positive integer index of first value
                stop(int): Positive integer index to end before (not returned)
        
            Retrieve next value(s) in iterator.
        
            start and stop roughly behave like slice notation, but must be positive
            """
        
            last = max(start, (stop or 0) - 1)
        
            while last >= len(self.buffer):
                try:
                    self.buffer.append(next(self.iterator))
                except StopIteration:
                    break
        
    >       return self.buffer[start] if stop is None else self.buffer[start:stop]
    E       IndexError: list index out of range
    
    enlighten/_util.py:163: IndexError
    ====================================================================================== warnings summary ======================================================================================
    ../../../../../../usr/local/lib/python3.9/site-packages/pytest_asyncio/plugin.py:191
      /usr/local/lib/python3.9/site-packages/pytest_asyncio/plugin.py:191: DeprecationWarning: The 'asyncio_mode' default value will change to 'strict' in future, please explicitly use 'asyncio_mode=strict' or 'asyncio_mode=auto' in pytest configuration file.
        config.issue_config_time_warning(LEGACY_MODE, stacklevel=2)
    
    -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
    ================================================================================== short test summary info ===================================================================================
    SKIPPED [1] tests/test_notebook_manager.py:58: Notebook testing packages not installed
    ==================================================================== 9 failed, 120 passed, 1 skipped, 1 warning in 21.31s ====================================================================
    
    

    To Reproduce run pytest

    Environment (please complete the following information):

    • Enlighten Version: 1.11.0
    • OS and version: FreeBSD 13.1 STABLE
    • Console application: n/a
    • Special Conditions: n/a
    bug 
    opened by yurivict 10
  • Logging Interrupting Progress Bar

    Logging Interrupting Progress Bar

    Describe the bug When using enlighten and logging, the progress bar is being interrupted everytime I log.

    INFO:__main__:LOG
    INFO:__main__:LOG
    INFO:__main__:LOG
    INFO:__main__:LOG
    INFO:__main__:LOG
    INFO:__main__:LOG
    INFO:__main__:LOG
    INFO:__main__:LOG
    Backtesting  18%|█████████████████████▊                                                                                                   |  9/50 [00:00<00:01, 81.32 bars/s]INFO:__main__:LOG
    INFO:__main__:LOG
    INFO:__main__:LOG
    INFO:__main__:LOG
    INFO:__main__:LOG
    INFO:__main__:LOG
    INFO:__main__:LOG
    INFO:__main__:LOG
    INFO:__main__:LOG
    Backtesting  36%|███████████████████████████████████████████▌                                                                             | 18/50 [00:00<00:00, 81.41 bars/s]INFO:__main__:LOG
    

    To Reproduce

    import logging
    import time
    
    logging.basicConfig(level=logging.INFO)
    logger = logging.getLogger(__name__)
    
    my_list = list(range(50))
    pbar = enlighten.Counter(total=len(my_list), desc="Backtesting",
                                          unit="bars", color="blue")
    
    for l in my_list:
        time.sleep(.01)
        logger.info("LOG")
        pbar.update()
    

    Environment (please complete the following information):

    • Enlighten Version: 1.11.1
    • OS and version: MacOS M1 Chip
    • Console application: iterm2
    • Special Conditions: Running with poetry in python 3.10.5
    bug 
    opened by ngriffiths13 2
  • Allow Manager instances to be passed between processes

    Allow Manager instances to be passed between processes

    Is your feature request related to a problem? Please describe. I would like a subprocess to be able to update a counter while there are other counters managed by the main process.

    Right now a manager can't be shared because it cannot share the TextIOWrapper that is stdout/stderr, so new managers are writing over eachother.

    Describe the solution you'd like Ideally I'd like to be able to pass an instance of a Manager to a child process and let the child process create and update counters. This probably involves some kind of pickle-specific behavior to ensure the main processes' output streams aren't attempted to be copied.

    Describe alternatives you've considered A less change-heavy alternative could be to add an additional class (maybe ManagerProxy) which could be retrieved from an existing manager (manager.get_proxy()) and this new instance could pickled in order to share it with child processes. The proxy would have the same API, but all output would be sent via a pipe and read by the parent process during an update.

    The proxy approach might not work well if the main process blocks for a long period, but perhaps a process just for directing terminal output could be started.

    Additional context Tried to pass the manager between processes:

    TypeError: cannot pickle '_io.TextIOWrapper' object
    

    Originally I was using tqdm, which did work between processes but every progress bar had to be positioned manually and they would interfere if processes updated the bars at the same time.

    Feature Request 
    opened by robobenklein 5
  • Tracking PyCharm/IntelliJ/CLion CSR issue

    Tracking PyCharm/IntelliJ/CLion CSR issue

    Describe the bug enlighten doesn't seem to support "Terminal" in JetBrain's IDEs

    To Reproduce Run demo.py in the "Terminal" tab in PyCharm

    Environment (please complete the following information):

    • Enlighten Version: 1.6.2
    • OS and version: MacOS 10.15.7
    • Console application: PyCharm 2020.2.3
    • Special Conditions: N/A

    Additional context Maybe I'm missing something? A brand new PyCharm install, and using the normal Terminal tab Screen Shot 2020-10-08 at 11 43 51 AM

    Not a Bug 
    opened by dominick-han 5
Releases(1.11.1)
  • 1.11.1(Oct 10, 2022)

    Bugfixes

    • Wrong stream referenced in tests
    • Multiple bug fixes for utility classes used by NotebookManager
      • HTMLConverter: Don't test blink if not listed as supported on platform
      • HTMLConverter: Did not handle when term.normal was a single termcap
      • HTMLConverter: Friendly color names depended on the platform
        • Now friendly color names are always used for class names when available
      • HTMLConverter: Tests attempted to use a different term kind than other tests
      • Lookahead raised exception when iterator was empty

    Changes

    • HTMLConverter: Termcap parsing is now cached to improve performance for multiple lookups.
    Source code(tar.gz)
    Source code(zip)
  • 1.11.0(Sep 29, 2022)

    Changes

    • Default to sys.__stdout__ instead of sys.stdout
      • For most this will be a no-op change since sys.stdout, by default, references sys.__stdout__
      • Should increase compatibility on platforms where stdout has been redirected such as #49

    Housekeeping

    • Code tweaks and linting fixes
    Source code(tar.gz)
    Source code(zip)
  • 1.10.2(Dec 12, 2021)

    Changes

    • Curly braces in field names no longer have to be escaped #45

    Bugfixes

    • Bytecode for examples and tests no longer included in sdist
    • companion_stream tests did not provide coverage in some test environments
    • TestManager.test_autorefresh failed on macOS #44

    Housekeeping

    • Switched to GitHub Actions for testing
    • Fixes for Pylint changes
    Source code(tar.gz)
    Source code(zip)
  • 1.10.1(May 14, 2021)

    Bugfixes

    • Jupyter output order reversed
    • Special characters in Jupyter output not escaped
    • Demo example imports break depending on how it's called
    • Whitespace missing on PyPI readme
    Source code(tar.gz)
    Source code(zip)
  • 1.10.0(May 13, 2021)

  • 1.9.0(Mar 28, 2021)

    New Features

    • Human-readable numeric prefixes #29
      • Allows automatic conversion of SI (metric) and IEC (binary) unit prefixes
    • Improved exemption messages for unavailable reserve fields
    • rate_0, rate_00, interval_0, and interval_00 added as formatting fields

    Changes

    • New dependency: Prefixed
    • all_fields can now be specified as a keyword argument to Counter to set the default value for subcounters

    Housekeeping

    • Minor refactoring and optimizations
    • Demo updated
    • Added Conda badge and instructions
    Source code(tar.gz)
    Source code(zip)
  • 1.8.0(Feb 23, 2021)

    New Features

    • Manager.counter() and Manager.status_bar() now have a replace keyword argument

      • replace value must be an existing managed counter or status bar
      • New counter will assume the position of the counter it replaces
      • Old counter will be closed and removed
      • Equivalent to setting leave=False and running counter.close before adding a new counter
    • percentage_00 and count_00 added as bar_format formatting fields (#42)

      • Sum of percentages and counts for all subcounters
      • Inverse of percentage_0 and count_0

    Changes

    Bugfixes

    • Improved behavior of multicolored bars to avoid partial bars when count is 0 (#41)

    Housekeeping

    • Fixed typos
    • Minor refactoring
    Source code(tar.gz)
    Source code(zip)
  • 1.7.2(Dec 26, 2020)

    Changes

    • Manager() argument, threaded, now defaults to True when multiple processes are detected
    • Evaluation of Manager() argument, threaded, now deferred until scroll area is set when not set explicitly
    • Added FAQ question about reentrant calls

    Housekeeping

    • blessed.Terminal subclass removed
    • Removed assert statements from code
    Source code(tar.gz)
    Source code(zip)
  • 1.7.1(Dec 22, 2020)

  • 1.7.0(Nov 30, 2020)

    New Features

    • Added interval, the inverse of rate as a built-in formatting field. [ Issue #34 ]
    • Added new Manager() argument, threaded, which forces threading behavior when True
      • Defaults to True when multiple threads are detected

    Changes

    • Deferred resize handing introduced in 1.6.2 is now only performed if threaded is True (default when multiple threads are detected)

    Bugfixes

    • Improved resize handing [ Issue #33 ]

    Housekeeping

    • Add 3.9 support to package metadata
    • Minor optimizations
    Source code(tar.gz)
    Source code(zip)
  • 1.6.2(Aug 25, 2020)

    Changes

    • Output will now be resized on the first write after a resize is detected
      • This addresses an issue that can cause threaded programs to crash #28
    • Default Unicode are now used when running under Windows Terminal
      • Other windows terminals, like CMD, will still default to cp65001 compatible characters

    Bug fixes'

    • Additional stream flushes added to ensure incidental flush aren't relied upon #21
    • Updated RPM installation instructions
    Source code(tar.gz)
    Source code(zip)
  • 1.6.1(Jul 29, 2020)

    Changes

    • Warning is now emitted when a reserved field is passed as a user-defined field
    • Drop Python 2.6 support
    • Begin testing 3.10-dev

    Bug fixes

    • Preserve max scroll offset when number of status bars decrease (#27)
    • Minor doc fixes
    Source code(tar.gz)
    Source code(zip)
  • 1.6.0(Jun 19, 2020)

    New Features

    • Status bars can now be created with Manager.status_bar()
    • Bars can now be invoked with autorefresh=True to trigger a refresh whenever another bar is updated or refreshed
    • fill can now be used multiple times in counters and status bars
      • Remaining space is divided equally
    • Fill character can now be specified for counters, with fill keyword
    • Compound colors, like 'aqua_on_seagreen' are now supported
    • Additional keywords passed to Counter() and Counter.update() are now used as user-defined fields

    Changes

    Bug fixes

    • Position pinning now works as expected
    Source code(tar.gz)
    Source code(zip)
  • 1.5.2(May 23, 2020)

  • 1.5.1(Mar 29, 2020)

    Bug Fixes:

    • Fix Read The Docs references that point to latest
    • Support counter tests in non-Unicode environments
    • Account for unsupported encoding value when determining default series
    Source code(tar.gz)
    Source code(zip)
  • 1.5.0(Mar 23, 2020)

    New Features:

    • Support for RGB and X11 colors
    • New parameter for Counter(): additional_fields
      • User-defined fields available for counter formatting
    • New multiprocessing example
    • Subcounter fields count_n and rate_n are now available in counter-only format
    • New repr output

    Bug Fixes:

    • Fallback series for non-unicode encoding #13
    • Workaround implemented for Python 3.9 Issue 39966

    Changes:

    • Drop EL6-specific testing
      • Python 2.6 automated testing is still enabled, but failures are non-blocking
    • Specifying color by index is now deprecated
    • Minimum supported version of Blessed is 1.17.2

    Housekeeping:

    • Added Python 3.9-dev testing
    Source code(tar.gz)
    Source code(zip)
  • 1.4.0(Oct 26, 2019)

    New Features:

    • Escape sequences automatically detected when determining bar width When offset is set, this functionality is disabled

    Changes:

    • Flush streams on program exit Prevents escape processing from being disabled on Windows before all data with written to the terminal
    • Use Blessed for Windows support Windows support in Enlighten has been merged into Blessed

    Housekeeping:

    • Update FAQ
    • Cleanup Examples
    • Unicode cleanup (Python 2.7)
    • Add tests and metadata for Python 3.8 Final
    Source code(tar.gz)
    Source code(zip)
  • 1.3.3(Oct 1, 2019)

  • 1.3.2(Oct 1, 2019)

  • 1.3.1(Sep 30, 2019)

    • Bugfix: Account for stream without encoding attribute
    • Add PEP 508 dependency logic
    • Manager logic when using Counter directly now uses get_manager()
    Source code(tar.gz)
    Source code(zip)
  • 1.3.0(Apr 15, 2019)

  • 1.2.0(Mar 30, 2019)

  • 1.1.0(Dec 17, 2018)

  • 1.0.7(Nov 28, 2017)

  • 1.0.6(Oct 14, 2017)

Owner
Rockhopper Technologies
Linux and Open Source Consulting
Rockhopper Technologies
Standalone Tailwind CSS CLI, installable via pip

Standalone Tailwind CSS CLI, installable via pip Use Tailwind CSS without Node.j

Tim Kamanin 144 Dec 22, 2022
A command line utility to export Google Keep notes to markdown.

Keep-Exporter A command line utility to export Google Keep notes to markdown files with metadata stored as a frontmatter header. Supports exporting: S

Nathan Beals 85 Dec 17, 2022
Open a file in your locally running Visual Studio Code instance from arbitrary terminal connections.

code-connect Open a file in your locally running Visual Studio Code instance from arbitrary terminal connections. Motivation VS Code supports opening

Christian Volkmann 56 Nov 19, 2022
The project help you to quickly build layouts in terminal,cross-platform

The project help you to quickly build layouts in terminal,cross-platform

gojuukaze 133 Nov 30, 2022
Kubernetes shell: An integrated shell for working with the Kubernetes

kube-shell Kube-shell: An integrated shell for working with the Kubernetes CLI Under the hood kube-shell still calls kubectl. Kube-shell aims to provi

CloudNative Labs 2.2k Jan 08, 2023
jenkins-tui is a terminal based user interface for Jenkins.

jenkins-tui 📦 jenkins-tui is a terminal based user interface for Jenkins. 🚧 ⚠️ This app is a prototype and in very early stages of development. Ther

Craig Gumbley 22 Oct 24, 2022
A selfbot made with DPY, doesn't have much commands but there's some useful commands to use.

Phantom Selfbot A selfbot made in DPY, made by Zenith. How to use Add your token in token = 'YOUR-MOMS-TOKEN-HERE' Change the prefix in prefix = If

[Ͼ⁴] Ƶephyr 2 Dec 02, 2021
inklayers is a command line program that exports layers from an SVG file.

inklayers is a command line program that exports layers from an SVG file. It can be used to create slide shows by editing a single SVG file.

11 Mar 29, 2022
A Python module and command-line utility for converting .ANS format ANSI art to HTML

ansipants A Python module and command-line utility for converting .ANS format ANSI art to HTML. Installation pip install ansipants Command-line usage

4 Oct 16, 2022
Hurry is a CLI tool to speed setting up MoniGoMani HyperStrategy & co. #freqtrade #hyperopting #trading #strategy

Hurry is a CLI tool to speed setting up MoniGoMani HyperStrategy & co. #freqtrade #hyperopting #trading #strategy

10 Dec 29, 2022
Postgres CLI with autocompletion and syntax highlighting

A REPL for Postgres This is a postgres client that does auto-completion and syntax highlighting. Home Page: http://pgcli.com MySQL Equivalent: http://

dbcli 10.8k Jan 02, 2023
doq (python docstring generator) extension for coc.nvim

coc-pydocstring doq (python docstring generator) extension for coc.nvim Install CocInstall: :CocInstall coc-pydocstring vim-plug: Plug 'yaegassy/coc-p

yaegassy 27 Jan 04, 2023
Pyreadline3 - Windows implementation of the GNU readline library

pyreadline3 The pyreadline3 package is based on the stale package pyreadline loc

32 Jan 06, 2023
pypyr task-runner cli & api for automation pipelines.

pypyr task-runner cli & api for automation pipelines. Automate anything by combining commands, different scripts in different languages & applications into one pipeline process.

pypyr 471 Dec 15, 2022
StackOverflow in your terminal.

how. How do I ...? This project was started to help developers ask more questions. Table of Contents Installation Usage Foss Community Copyright Insta

Ron Nathaniel 2 Jan 31, 2022
ddgr is a cmdline utility to search DuckDuckGo (html version) from the terminal

ddgr is a cmdline utility to search DuckDuckGo (html version) from the terminal. While googler is extremely popular among cmdline users, in many forums the need of a similar utility for privacy-aware

Piña Colada 2.5k Dec 25, 2022
Booky - A command line utility for bookmarking files on your terminal!

Booky A command line utility for bookmarking files for quick access With it you can: Bookmark and delete your (aliases of) files at demand Launch them

Pran 1 Sep 11, 2022
Python commandline tool for remembering linux/terminal commands

ehh Remember linux commands Commandline tool for remembering linux/terminal commands. It stores your favorite commands in ~/ehh.json in your homedir a

56 Nov 10, 2022
A CLI Spigot plugin manager that adheres to Unix conventions and Python best practices.

Spud A cross-platform, Spigot plugin manager that adheres to the Unix philosophy and Python best practices. Some focuses of the project are: Easy and

Tommy Dougiamas 9 Dec 02, 2022
A simple automation script that logs into your kra account and files your taxes with one command

EASY_TAX A simple automation script that logs into your kra account and files your taxes with one command Currently works for Chrome users. Will creat

leon koech 13 Sep 23, 2021