enlighten


Nameenlighten JSON
Version 1.12.4 PyPI version JSON
download
home_pagehttps://github.com/Rockhopper-Technologies/enlighten
SummaryEnlighten Progress Bar
upload_time2023-12-25 21:40:09
maintainerAvram Lubkin
docs_urlNone
authorAvram Lubkin
requires_python
licenseMPLv2.0
keywords progress bar progressbar counter status statusbar
VCS
bugtrack_url
requirements blessed prefixed
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. start-badges

| |docs| |gh_actions| |codecov|
| |linux| |windows| |mac| |bsd|
| |pypi| |supported-versions| |supported-implementations|
| |Fedora| |EPEL| |Debian| |Ubuntu| |Anaconda|

.. |docs| image:: https://img.shields.io/readthedocs/python-enlighten.svg?style=plastic&logo=read-the-docs
    :target: https://python-enlighten.readthedocs.org
    :alt: Documentation Status

.. |gh_actions| image:: https://img.shields.io/github/actions/workflow/status/Rockhopper-Technologies/enlighten/tests.yml?event=push&logo=github-actions&style=plastic
    :target: https://github.com/Rockhopper-Technologies/enlighten/actions/workflows/tests.yml
    :alt: GitHub Actions Status

.. |travis| image:: https://img.shields.io/travis/com/Rockhopper-Technologies/enlighten.svg?style=plastic&logo=travis
    :target: https://travis-ci.com/Rockhopper-Technologies/enlighten
    :alt: Travis-CI Build Status

.. |codecov| image:: https://img.shields.io/codecov/c/github/Rockhopper-Technologies/enlighten.svg?style=plastic&logo=codecov
    :target: https://codecov.io/gh/Rockhopper-Technologies/enlighten
    :alt: Coverage Status

.. |pypi| image:: https://img.shields.io/pypi/v/enlighten.svg?style=plastic&logo=pypi
    :alt: PyPI Package latest release
    :target: https://pypi.python.org/pypi/enlighten

.. |supported-versions| image:: https://img.shields.io/pypi/pyversions/enlighten.svg?style=plastic&logo=pypi
    :alt: Supported versions
    :target: https://pypi.python.org/pypi/enlighten

.. |supported-implementations| image:: https://img.shields.io/pypi/implementation/enlighten.svg?style=plastic&logo=pypi
    :alt: Supported implementations
    :target: https://pypi.python.org/pypi/enlighten

.. |linux| image:: https://img.shields.io/badge/Linux-yes-success?style=plastic&logo=linux
    :alt: Linux supported
    :target: https://pypi.python.org/pypi/enlighten

.. |windows| image:: https://img.shields.io/badge/Windows-yes-success?style=plastic&logo=windows
    :alt: Windows supported
    :target: https://pypi.python.org/pypi/enlighten

.. |mac| image:: https://img.shields.io/badge/MacOS-yes-success?style=plastic&logo=apple
    :alt: MacOS supported
    :target: https://pypi.python.org/pypi/enlighten

.. |bsd| image:: https://img.shields.io/badge/BSD-yes-success?style=plastic&logo=freebsd
    :alt: BSD supported
    :target: https://pypi.python.org/pypi/enlighten

.. |Fedora| image:: https://img.shields.io/fedora/v/python3-enlighten?color=lightgray&logo=Fedora&style=plastic&label=Fedora
    :alt: Latest Fedora Version
    :target: https://src.fedoraproject.org/rpms/python-enlighten

.. |EPEL| image:: https://img.shields.io/fedora/v/python3-enlighten/epel8?color=lightgray&label=EPEL&logo=EPEL
    :alt: Latest EPEL Version
    :target: https://src.fedoraproject.org/rpms/python-enlighten

.. |Debian| image:: https://img.shields.io/debian/v/enlighten/sid?color=lightgray&logo=Debian&style=plastic&label=Debian
    :alt: Latest Debian Version
    :target: https://packages.debian.org/source/sid/enlighten

.. |Ubuntu| image:: https://img.shields.io/ubuntu/v/enlighten?color=lightgray&logo=Ubuntu&style=plastic&label=Ubuntu
    :alt: Latest Ubuntu Version
    :target: https://launchpad.net/ubuntu/+source/enlighten

.. |Anaconda| image:: https://img.shields.io/conda/vn/conda-forge/enlighten?color=lightgrey&label=Anaconda&logo=Conda%20Forge&style=plastic
    :alt: Latest Conda Forge Version
    :target: https://anaconda.org/conda-forge/enlighten

.. end-badges

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.

|

.. image:: https://raw.githubusercontent.com/Rockhopper-Technologies/enlighten/master/doc/_static/demo.gif
    :target: http://python-enlighten.readthedocs.io/en/stable/examples.html

The code for this animation can be found in
`demo.py <https://github.com/Rockhopper-Technologies/enlighten/blob/master/examples/demo.py>`__
in
`examples <https://github.com/Rockhopper-Technologies/enlighten/tree/master/examples>`__.

Documentation
=============

https://python-enlighten.readthedocs.io

Installation
============

PIP
---

.. code-block:: console

    $ pip install enlighten


RPM
---

Fedora and EL8 (RHEL/CentOS)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

(For EPEL_ repositories must be configured_)

.. code-block:: console

    $ dnf install python3-enlighten


DEB
---

Debian and Ubuntu
^^^^^^^^^^^^^^^^^
.. code-block:: console

    $ apt-get install python3-enlighten


Conda
-----

.. code-block:: console

    $ conda install -c conda-forge enlighten


.. _EPEL: https://fedoraproject.org/wiki/EPEL
.. _configured: https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F


How to Use
==========

Managers
--------

The first step is to create a manager. Managers handle output to the terminal and allow multiple
progress bars to be displayed at the same time.

get_manager_ can be used to get a Manager_ instance.
Managers will only display output when the output stream, ``sys.__stdout__`` by default,
is attached to a TTY. If the stream is not attached to a TTY, the manager instance returned will be
disabled.

In most cases, a manager can be created like this.

.. code-block:: python

    import enlighten
    manager = enlighten.get_manager()

If you need to use a different output stream, or override the defaults, see the documentation for
get_manager_


Progress Bars
-------------

For a basic progress bar, invoke the Manager.counter_ method.

.. code-block:: python

    import time
    import enlighten

    manager = enlighten.get_manager()
    pbar = manager.counter(total=100, desc='Basic', unit='ticks')

    for num in range(100):
        time.sleep(0.1)  # Simulate work
        pbar.update()

Additional progress bars can be created with additional calls to the
Manager.counter_ method.

.. code-block:: python

    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:

.. code-block:: python

    import time
    import enlighten

    manager = enlighten.get_manager()
    counter = manager.counter(desc='Basic', unit='ticks')

    for num in range(100):
        time.sleep(0.1)  # Simulate work
        counter.update()

Status Bars
-----------
Status bars are bars that work similarly to progress bars and counters, but present relatively
static information. Status bars are created with
Manager.status_bar_.

.. code-block:: python

    import enlighten
    import time

    manager = enlighten.get_manager()
    status_bar = manager.status_bar('Static Message',
                                    color='white_on_red',
                                    justify=enlighten.Justify.CENTER)
    time.sleep(1)
    status_bar.update('Updated static message')
    time.sleep(1)

Status bars can also use formatting with dynamic variables.

.. code-block:: python

    import enlighten
    import time

    manager = enlighten.get_manager()
    status_format = '{program}{fill}Stage: {stage}{fill} Status {status}'
    status_bar = manager.status_bar(status_format=status_format,
                                    color='bold_slategray',
                                    program='Demo',
                                    stage='Loading',
                                    status='OKAY')
    time.sleep(1)
    status_bar.update(stage='Initializing', status='OKAY')
    time.sleep(1)
    status_bar.update(status='FAIL')

Status bars, like other bars can be pinned. To pin a status bar to the top of all other bars,
initialize it before any other bars. To pin a bar to the bottom of the screen, use
``position=1`` when initializing.

See StatusBar_ for more details.

Color
-----

Status bars and the bar component of a progress bar can be colored by setting the
``color`` keyword argument. See
`Series Color <https://python-enlighten.readthedocs.io/en/stable/api.html#series-color>`_ for more
information about valid colors.

.. code-block:: python

    import time
    import enlighten

    manager = enlighten.get_manager()
    counter = manager.counter(total=100, desc='Colorized', unit='ticks', color='red')

    for num in range(100):
        time.sleep(0.1)  # Simulate work
    counter.update()

Additionally, any part of the progress bar can be colored using `counter
formatting <https://python-enlighten.readthedocs.io/en/stable/api.html#counter-format>`_ and the
`color capabilities <https://blessed.readthedocs.io/en/stable/colors.html>`_
of the underlying `Blessed <https://blessed.readthedocs.io/en/stable>`_
`Terminal <https://blessed.readthedocs.io/en/stable/terminal.html>`_.

.. code-block:: python

    import enlighten

    manager = enlighten.get_manager()

    # Standard bar format
    std_bar_format = u'{desc}{desc_pad}{percentage:3.0f}%|{bar}| ' + \
                     u'{count:{len_total}d}/{total:d} ' + \
                     u'[{elapsed}<{eta}, {rate:.2f}{unit_pad}{unit}/s]'

    # Red text
    bar_format = manager.term.red(std_bar_format)

    # Red on white background
    bar_format = manager.term.red_on_white(std_bar_format)

    # X11 colors
    bar_format = manager.term.peru_on_seagreen(std_bar_format)

    # RBG text
    bar_format = manager.term.color_rgb(2, 5, 128)(std_bar_format)

    # RBG background
    bar_format = manager.term.on_color_rgb(255, 190, 195)(std_bar_format)

    # RGB text and background
    bar_format = manager.term.on_color_rgb(255, 190, 195)(std_bar_format)
    bar_format = manager.term.color_rgb(2, 5, 128)(bar_format)

    # Apply color to select parts
    bar_format = manager.term.red(u'{desc}') + u'{desc_pad}' + \
                 manager.term.blue(u'{percentage:3.0f}%') + u'|{bar}|'

    # Apply to counter
    ticks = manager.counter(total=100, desc='Ticks', unit='ticks', bar_format=bar_format)

If the ``color`` option is applied to a Counter_,
it will override any foreground color applied.



Multicolored
------------

The bar component of a progress bar can be multicolored to track multiple categories in a single
progress bar.

The colors are drawn from right to left in the order they were added.

By default, when multicolored progress bars are used, additional fields are available for
``bar_format``:

    - count_n (``int``) - Current value of ``count``
    - count_0(``int``) - Remaining count after deducting counts for all subcounters
    - count_00 (``int``) - Sum of counts from all subcounters
    - percentage_n (``float``) - Percentage complete
    - percentage_0(``float``) - Remaining percentage after deducting percentages
      for all subcounters
    - percentage_00 (``float``) - Total of percentages from all subcounters

When Counter.add_subcounter_ is called with ``all_fields`` set to ``True``,
the subcounter will have the additional fields:

    - eta_n (``str``) - Estimated time to completion
    - rate_n (``float``) - Average increments per second since parent was created

More information about ``bar_format`` can be found in the Format_ section of the API.

One use case for multicolored progress bars is recording the status of a series of tests.
In this example, Failures are red, errors are white, and successes are green. The count of each is
listed in the progress bar.

.. code-block:: python

    import random
    import time
    import enlighten

    bar_format = u'{desc}{desc_pad}{percentage:3.0f}%|{bar}| ' + \
                u'S:{count_0:{len_total}d} ' + \
                u'F:{count_2:{len_total}d} ' + \
                u'E:{count_1:{len_total}d} ' + \
                u'[{elapsed}<{eta}, {rate:.2f}{unit_pad}{unit}/s]'

    manager = enlighten.get_manager()
    success = manager.counter(total=100, desc='Testing', unit='tests',
                                color='green', bar_format=bar_format)
    errors = success.add_subcounter('white')
    failures = success.add_subcounter('red')

    while success.count < 100:
        time.sleep(random.uniform(0.1, 0.3))  # Random processing time
        result = random.randint(0, 10)

        if result == 7:
            errors.update()
        if result in (5, 6):
            failures.update()
        else:
            success.update()

A more complicated example is recording process start-up. In this case, all items will start red,
transition to yellow, and eventually all will be green. The count, percentage, rate, and eta fields
are all derived from the second subcounter added.

.. code-block:: python

    import random
    import time
    import enlighten

    services = 100
    bar_format = u'{desc}{desc_pad}{percentage_2:3.0f}%|{bar}|' + \
                u' {count_2:{len_total}d}/{total:d} ' + \
                u'[{elapsed}<{eta_2}, {rate_2:.2f}{unit_pad}{unit}/s]'

    manager = enlighten.get_manager()
    initializing = manager.counter(total=services, desc='Starting', unit='services',
                                    color='red', bar_format=bar_format)
    starting = initializing.add_subcounter('yellow')
    started = initializing.add_subcounter('green', all_fields=True)

    while started.count < services:
        remaining = services - initializing.count
        if remaining:
            num = random.randint(0, min(4, remaining))
            initializing.update(num)

        ready = initializing.count - initializing.subcount
        if ready:
            num = random.randint(0, min(3, ready))
            starting.update_from(initializing, num)

        if starting.count:
            num = random.randint(0, min(2, starting.count))
            started.update_from(starting, num)

        time.sleep(random.uniform(0.1, 0.5))  # Random processing time


Additional Examples
-------------------
* `basic <https://raw.githubusercontent.com/Rockhopper-Technologies/enlighten/master/examples/basic.py>`__ - Basic progress bar
* `context manager <https://raw.githubusercontent.com/Rockhopper-Technologies/enlighten/master/examples/context_manager.py>`__ - Managers and counters as context managers
* `floats <https://raw.githubusercontent.com/Rockhopper-Technologies/enlighten/master/examples/floats.py>`__ - Support totals and counts that are ``floats``
* `multicolored <https://raw.githubusercontent.com/Rockhopper-Technologies/enlighten/master/examples/multicolored.py>`__ - Multicolored progress bars
* `multiple with logging <https://raw.githubusercontent.com/Rockhopper-Technologies/enlighten/master/examples/multiple_logging.py>`__ - Nested progress bars and logging
* `FTP downloader <https://raw.githubusercontent.com/Rockhopper-Technologies/enlighten/master/examples/ftp_downloader.py>`__ - Show progress downloading files from FTP

Customization
-------------

Enlighten is highly configurable. For information on modifying the output, see the
Series_ and Format_ sections of the Counter_ documentation.

.. _Counter: http://python-enlighten.readthedocs.io/en/stable/api.html#enlighten.Counter
.. _Counter.add_subcounter: https://python-enlighten.readthedocs.io/en/stable/api.html#enlighten.Counter.add_subcounter
.. _StatusBar: https://python-enlighten.readthedocs.io/en/stable/api.html#enlighten.StatusBar
.. _Manager: http://python-enlighten.readthedocs.io/en/stable/api.html#enlighten.Manager
.. _Manager.counter: https://python-enlighten.readthedocs.io/en/stable/api.html#enlighten.Manager.counter
.. _Manager.status_bar: https://python-enlighten.readthedocs.io/en/stable/api.html#enlighten.Manager.status_bar
.. _get_manager: http://python-enlighten.readthedocs.io/en/stable/api.html#enlighten.get_manager
.. _Format: http://python-enlighten.readthedocs.io/en/stable/api.html#counter-format
.. _Series: http://python-enlighten.readthedocs.io/en/stable/api.html#series
.. _EPEL: https://fedoraproject.org/wiki/EPEL
.. _configured: https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Rockhopper-Technologies/enlighten",
    "name": "enlighten",
    "maintainer": "Avram Lubkin",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "avylove@rockhopper.net",
    "keywords": "progress,bar,progressbar,counter,status,statusbar",
    "author": "Avram Lubkin",
    "author_email": "avylove@rockhopper.net",
    "download_url": "https://files.pythonhosted.org/packages/ff/e9/01f7161ca7dfc693530441af1a4de664e9e3d487e02cd6ba50dfd55b7fba/enlighten-1.12.4.tar.gz",
    "platform": null,
    "description": ".. start-badges\n\n| |docs| |gh_actions| |codecov|\n| |linux| |windows| |mac| |bsd|\n| |pypi| |supported-versions| |supported-implementations|\n| |Fedora| |EPEL| |Debian| |Ubuntu| |Anaconda|\n\n.. |docs| image:: https://img.shields.io/readthedocs/python-enlighten.svg?style=plastic&logo=read-the-docs\n    :target: https://python-enlighten.readthedocs.org\n    :alt: Documentation Status\n\n.. |gh_actions| image:: https://img.shields.io/github/actions/workflow/status/Rockhopper-Technologies/enlighten/tests.yml?event=push&logo=github-actions&style=plastic\n    :target: https://github.com/Rockhopper-Technologies/enlighten/actions/workflows/tests.yml\n    :alt: GitHub Actions Status\n\n.. |travis| image:: https://img.shields.io/travis/com/Rockhopper-Technologies/enlighten.svg?style=plastic&logo=travis\n    :target: https://travis-ci.com/Rockhopper-Technologies/enlighten\n    :alt: Travis-CI Build Status\n\n.. |codecov| image:: https://img.shields.io/codecov/c/github/Rockhopper-Technologies/enlighten.svg?style=plastic&logo=codecov\n    :target: https://codecov.io/gh/Rockhopper-Technologies/enlighten\n    :alt: Coverage Status\n\n.. |pypi| image:: https://img.shields.io/pypi/v/enlighten.svg?style=plastic&logo=pypi\n    :alt: PyPI Package latest release\n    :target: https://pypi.python.org/pypi/enlighten\n\n.. |supported-versions| image:: https://img.shields.io/pypi/pyversions/enlighten.svg?style=plastic&logo=pypi\n    :alt: Supported versions\n    :target: https://pypi.python.org/pypi/enlighten\n\n.. |supported-implementations| image:: https://img.shields.io/pypi/implementation/enlighten.svg?style=plastic&logo=pypi\n    :alt: Supported implementations\n    :target: https://pypi.python.org/pypi/enlighten\n\n.. |linux| image:: https://img.shields.io/badge/Linux-yes-success?style=plastic&logo=linux\n    :alt: Linux supported\n    :target: https://pypi.python.org/pypi/enlighten\n\n.. |windows| image:: https://img.shields.io/badge/Windows-yes-success?style=plastic&logo=windows\n    :alt: Windows supported\n    :target: https://pypi.python.org/pypi/enlighten\n\n.. |mac| image:: https://img.shields.io/badge/MacOS-yes-success?style=plastic&logo=apple\n    :alt: MacOS supported\n    :target: https://pypi.python.org/pypi/enlighten\n\n.. |bsd| image:: https://img.shields.io/badge/BSD-yes-success?style=plastic&logo=freebsd\n    :alt: BSD supported\n    :target: https://pypi.python.org/pypi/enlighten\n\n.. |Fedora| image:: https://img.shields.io/fedora/v/python3-enlighten?color=lightgray&logo=Fedora&style=plastic&label=Fedora\n    :alt: Latest Fedora Version\n    :target: https://src.fedoraproject.org/rpms/python-enlighten\n\n.. |EPEL| image:: https://img.shields.io/fedora/v/python3-enlighten/epel8?color=lightgray&label=EPEL&logo=EPEL\n    :alt: Latest EPEL Version\n    :target: https://src.fedoraproject.org/rpms/python-enlighten\n\n.. |Debian| image:: https://img.shields.io/debian/v/enlighten/sid?color=lightgray&logo=Debian&style=plastic&label=Debian\n    :alt: Latest Debian Version\n    :target: https://packages.debian.org/source/sid/enlighten\n\n.. |Ubuntu| image:: https://img.shields.io/ubuntu/v/enlighten?color=lightgray&logo=Ubuntu&style=plastic&label=Ubuntu\n    :alt: Latest Ubuntu Version\n    :target: https://launchpad.net/ubuntu/+source/enlighten\n\n.. |Anaconda| image:: https://img.shields.io/conda/vn/conda-forge/enlighten?color=lightgrey&label=Anaconda&logo=Conda%20Forge&style=plastic\n    :alt: Latest Conda Forge Version\n    :target: https://anaconda.org/conda-forge/enlighten\n\n.. end-badges\n\nOverview\n========\n\nEnlighten Progress Bar is a console progress bar library for Python.\n\nThe main advantage of Enlighten is it allows writing to stdout and stderr without any\nredirection or additional code. Just print or log as you normally would.\n\nEnlighten also includes experimental support for Jupyter Notebooks.\n\n|\n\n.. image:: https://raw.githubusercontent.com/Rockhopper-Technologies/enlighten/master/doc/_static/demo.gif\n    :target: http://python-enlighten.readthedocs.io/en/stable/examples.html\n\nThe code for this animation can be found in\n`demo.py <https://github.com/Rockhopper-Technologies/enlighten/blob/master/examples/demo.py>`__\nin\n`examples <https://github.com/Rockhopper-Technologies/enlighten/tree/master/examples>`__.\n\nDocumentation\n=============\n\nhttps://python-enlighten.readthedocs.io\n\nInstallation\n============\n\nPIP\n---\n\n.. code-block:: console\n\n    $ pip install enlighten\n\n\nRPM\n---\n\nFedora and EL8 (RHEL/CentOS)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n(For EPEL_ repositories must be configured_)\n\n.. code-block:: console\n\n    $ dnf install python3-enlighten\n\n\nDEB\n---\n\nDebian and Ubuntu\n^^^^^^^^^^^^^^^^^\n.. code-block:: console\n\n    $ apt-get install python3-enlighten\n\n\nConda\n-----\n\n.. code-block:: console\n\n    $ conda install -c conda-forge enlighten\n\n\n.. _EPEL: https://fedoraproject.org/wiki/EPEL\n.. _configured: https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F\n\n\nHow to Use\n==========\n\nManagers\n--------\n\nThe first step is to create a manager. Managers handle output to the terminal and allow multiple\nprogress bars to be displayed at the same time.\n\nget_manager_ can be used to get a Manager_ instance.\nManagers will only display output when the output stream, ``sys.__stdout__`` by default,\nis attached to a TTY. If the stream is not attached to a TTY, the manager instance returned will be\ndisabled.\n\nIn most cases, a manager can be created like this.\n\n.. code-block:: python\n\n    import enlighten\n    manager = enlighten.get_manager()\n\nIf you need to use a different output stream, or override the defaults, see the documentation for\nget_manager_\n\n\nProgress Bars\n-------------\n\nFor a basic progress bar, invoke the Manager.counter_ method.\n\n.. code-block:: python\n\n    import time\n    import enlighten\n\n    manager = enlighten.get_manager()\n    pbar = manager.counter(total=100, desc='Basic', unit='ticks')\n\n    for num in range(100):\n        time.sleep(0.1)  # Simulate work\n        pbar.update()\n\nAdditional progress bars can be created with additional calls to the\nManager.counter_ method.\n\n.. code-block:: python\n\n    import time\n    import enlighten\n\n    manager = enlighten.get_manager()\n    ticks = manager.counter(total=100, desc='Ticks', unit='ticks')\n    tocks = manager.counter(total=20, desc='Tocks', unit='tocks')\n\n    for num in range(100):\n        time.sleep(0.1)  # Simulate work\n        print(num)\n        ticks.update()\n        if not num % 5:\n            tocks.update()\n\n    manager.stop()\n\nCounters\n--------\n\nThe Counter_ class has two output formats, progress bar and counter.\n\nThe progress bar format is used when a total is not ``None`` and the count is less than the\ntotal. If neither of these conditions are met, the counter format is used:\n\n.. code-block:: python\n\n    import time\n    import enlighten\n\n    manager = enlighten.get_manager()\n    counter = manager.counter(desc='Basic', unit='ticks')\n\n    for num in range(100):\n        time.sleep(0.1)  # Simulate work\n        counter.update()\n\nStatus Bars\n-----------\nStatus bars are bars that work similarly to progress bars and counters, but present relatively\nstatic information. Status bars are created with\nManager.status_bar_.\n\n.. code-block:: python\n\n    import enlighten\n    import time\n\n    manager = enlighten.get_manager()\n    status_bar = manager.status_bar('Static Message',\n                                    color='white_on_red',\n                                    justify=enlighten.Justify.CENTER)\n    time.sleep(1)\n    status_bar.update('Updated static message')\n    time.sleep(1)\n\nStatus bars can also use formatting with dynamic variables.\n\n.. code-block:: python\n\n    import enlighten\n    import time\n\n    manager = enlighten.get_manager()\n    status_format = '{program}{fill}Stage: {stage}{fill} Status {status}'\n    status_bar = manager.status_bar(status_format=status_format,\n                                    color='bold_slategray',\n                                    program='Demo',\n                                    stage='Loading',\n                                    status='OKAY')\n    time.sleep(1)\n    status_bar.update(stage='Initializing', status='OKAY')\n    time.sleep(1)\n    status_bar.update(status='FAIL')\n\nStatus bars, like other bars can be pinned. To pin a status bar to the top of all other bars,\ninitialize it before any other bars. To pin a bar to the bottom of the screen, use\n``position=1`` when initializing.\n\nSee StatusBar_ for more details.\n\nColor\n-----\n\nStatus bars and the bar component of a progress bar can be colored by setting the\n``color`` keyword argument. See\n`Series Color <https://python-enlighten.readthedocs.io/en/stable/api.html#series-color>`_ for more\ninformation about valid colors.\n\n.. code-block:: python\n\n    import time\n    import enlighten\n\n    manager = enlighten.get_manager()\n    counter = manager.counter(total=100, desc='Colorized', unit='ticks', color='red')\n\n    for num in range(100):\n        time.sleep(0.1)  # Simulate work\n    counter.update()\n\nAdditionally, any part of the progress bar can be colored using `counter\nformatting <https://python-enlighten.readthedocs.io/en/stable/api.html#counter-format>`_ and the\n`color capabilities <https://blessed.readthedocs.io/en/stable/colors.html>`_\nof the underlying `Blessed <https://blessed.readthedocs.io/en/stable>`_\n`Terminal <https://blessed.readthedocs.io/en/stable/terminal.html>`_.\n\n.. code-block:: python\n\n    import enlighten\n\n    manager = enlighten.get_manager()\n\n    # Standard bar format\n    std_bar_format = u'{desc}{desc_pad}{percentage:3.0f}%|{bar}| ' + \\\n                     u'{count:{len_total}d}/{total:d} ' + \\\n                     u'[{elapsed}<{eta}, {rate:.2f}{unit_pad}{unit}/s]'\n\n    # Red text\n    bar_format = manager.term.red(std_bar_format)\n\n    # Red on white background\n    bar_format = manager.term.red_on_white(std_bar_format)\n\n    # X11 colors\n    bar_format = manager.term.peru_on_seagreen(std_bar_format)\n\n    # RBG text\n    bar_format = manager.term.color_rgb(2, 5, 128)(std_bar_format)\n\n    # RBG background\n    bar_format = manager.term.on_color_rgb(255, 190, 195)(std_bar_format)\n\n    # RGB text and background\n    bar_format = manager.term.on_color_rgb(255, 190, 195)(std_bar_format)\n    bar_format = manager.term.color_rgb(2, 5, 128)(bar_format)\n\n    # Apply color to select parts\n    bar_format = manager.term.red(u'{desc}') + u'{desc_pad}' + \\\n                 manager.term.blue(u'{percentage:3.0f}%') + u'|{bar}|'\n\n    # Apply to counter\n    ticks = manager.counter(total=100, desc='Ticks', unit='ticks', bar_format=bar_format)\n\nIf the ``color`` option is applied to a Counter_,\nit will override any foreground color applied.\n\n\n\nMulticolored\n------------\n\nThe bar component of a progress bar can be multicolored to track multiple categories in a single\nprogress bar.\n\nThe colors are drawn from right to left in the order they were added.\n\nBy default, when multicolored progress bars are used, additional fields are available for\n``bar_format``:\n\n    - count_n (``int``) - Current value of ``count``\n    - count_0(``int``) - Remaining count after deducting counts for all subcounters\n    - count_00 (``int``) - Sum of counts from all subcounters\n    - percentage_n (``float``) - Percentage complete\n    - percentage_0(``float``) - Remaining percentage after deducting percentages\n      for all subcounters\n    - percentage_00 (``float``) - Total of percentages from all subcounters\n\nWhen Counter.add_subcounter_ is called with ``all_fields`` set to ``True``,\nthe subcounter will have the additional fields:\n\n    - eta_n (``str``) - Estimated time to completion\n    - rate_n (``float``) - Average increments per second since parent was created\n\nMore information about ``bar_format`` can be found in the Format_ section of the API.\n\nOne use case for multicolored progress bars is recording the status of a series of tests.\nIn this example, Failures are red, errors are white, and successes are green. The count of each is\nlisted in the progress bar.\n\n.. code-block:: python\n\n    import random\n    import time\n    import enlighten\n\n    bar_format = u'{desc}{desc_pad}{percentage:3.0f}%|{bar}| ' + \\\n                u'S:{count_0:{len_total}d} ' + \\\n                u'F:{count_2:{len_total}d} ' + \\\n                u'E:{count_1:{len_total}d} ' + \\\n                u'[{elapsed}<{eta}, {rate:.2f}{unit_pad}{unit}/s]'\n\n    manager = enlighten.get_manager()\n    success = manager.counter(total=100, desc='Testing', unit='tests',\n                                color='green', bar_format=bar_format)\n    errors = success.add_subcounter('white')\n    failures = success.add_subcounter('red')\n\n    while success.count < 100:\n        time.sleep(random.uniform(0.1, 0.3))  # Random processing time\n        result = random.randint(0, 10)\n\n        if result == 7:\n            errors.update()\n        if result in (5, 6):\n            failures.update()\n        else:\n            success.update()\n\nA more complicated example is recording process start-up. In this case, all items will start red,\ntransition to yellow, and eventually all will be green. The count, percentage, rate, and eta fields\nare all derived from the second subcounter added.\n\n.. code-block:: python\n\n    import random\n    import time\n    import enlighten\n\n    services = 100\n    bar_format = u'{desc}{desc_pad}{percentage_2:3.0f}%|{bar}|' + \\\n                u' {count_2:{len_total}d}/{total:d} ' + \\\n                u'[{elapsed}<{eta_2}, {rate_2:.2f}{unit_pad}{unit}/s]'\n\n    manager = enlighten.get_manager()\n    initializing = manager.counter(total=services, desc='Starting', unit='services',\n                                    color='red', bar_format=bar_format)\n    starting = initializing.add_subcounter('yellow')\n    started = initializing.add_subcounter('green', all_fields=True)\n\n    while started.count < services:\n        remaining = services - initializing.count\n        if remaining:\n            num = random.randint(0, min(4, remaining))\n            initializing.update(num)\n\n        ready = initializing.count - initializing.subcount\n        if ready:\n            num = random.randint(0, min(3, ready))\n            starting.update_from(initializing, num)\n\n        if starting.count:\n            num = random.randint(0, min(2, starting.count))\n            started.update_from(starting, num)\n\n        time.sleep(random.uniform(0.1, 0.5))  # Random processing time\n\n\nAdditional Examples\n-------------------\n* `basic <https://raw.githubusercontent.com/Rockhopper-Technologies/enlighten/master/examples/basic.py>`__ - Basic progress bar\n* `context manager <https://raw.githubusercontent.com/Rockhopper-Technologies/enlighten/master/examples/context_manager.py>`__ - Managers and counters as context managers\n* `floats <https://raw.githubusercontent.com/Rockhopper-Technologies/enlighten/master/examples/floats.py>`__ - Support totals and counts that are ``floats``\n* `multicolored <https://raw.githubusercontent.com/Rockhopper-Technologies/enlighten/master/examples/multicolored.py>`__ - Multicolored progress bars\n* `multiple with logging <https://raw.githubusercontent.com/Rockhopper-Technologies/enlighten/master/examples/multiple_logging.py>`__ - Nested progress bars and logging\n* `FTP downloader <https://raw.githubusercontent.com/Rockhopper-Technologies/enlighten/master/examples/ftp_downloader.py>`__ - Show progress downloading files from FTP\n\nCustomization\n-------------\n\nEnlighten is highly configurable. For information on modifying the output, see the\nSeries_ and Format_ sections of the Counter_ documentation.\n\n.. _Counter: http://python-enlighten.readthedocs.io/en/stable/api.html#enlighten.Counter\n.. _Counter.add_subcounter: https://python-enlighten.readthedocs.io/en/stable/api.html#enlighten.Counter.add_subcounter\n.. _StatusBar: https://python-enlighten.readthedocs.io/en/stable/api.html#enlighten.StatusBar\n.. _Manager: http://python-enlighten.readthedocs.io/en/stable/api.html#enlighten.Manager\n.. _Manager.counter: https://python-enlighten.readthedocs.io/en/stable/api.html#enlighten.Manager.counter\n.. _Manager.status_bar: https://python-enlighten.readthedocs.io/en/stable/api.html#enlighten.Manager.status_bar\n.. _get_manager: http://python-enlighten.readthedocs.io/en/stable/api.html#enlighten.get_manager\n.. _Format: http://python-enlighten.readthedocs.io/en/stable/api.html#counter-format\n.. _Series: http://python-enlighten.readthedocs.io/en/stable/api.html#series\n.. _EPEL: https://fedoraproject.org/wiki/EPEL\n.. _configured: https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F\n",
    "bugtrack_url": null,
    "license": "MPLv2.0",
    "summary": "Enlighten Progress Bar",
    "version": "1.12.4",
    "project_urls": {
        "Documentation": "https://python-enlighten.readthedocs.io",
        "Homepage": "https://github.com/Rockhopper-Technologies/enlighten"
    },
    "split_keywords": [
        "progress",
        "bar",
        "progressbar",
        "counter",
        "status",
        "statusbar"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a34b5941c7e1d74aa16f32df3b2119c9c523e56b269fe7ae6af30d61f450c566",
                "md5": "da3bdec9eeeef79c9922a79e3fb6fa4d",
                "sha256": "5c53c57441bc5986c1d02f2f539aead9d59a206783641953a49b8d995db6b584"
            },
            "downloads": -1,
            "filename": "enlighten-1.12.4-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "da3bdec9eeeef79c9922a79e3fb6fa4d",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 41883,
            "upload_time": "2023-12-25T21:40:05",
            "upload_time_iso_8601": "2023-12-25T21:40:05.528659Z",
            "url": "https://files.pythonhosted.org/packages/a3/4b/5941c7e1d74aa16f32df3b2119c9c523e56b269fe7ae6af30d61f450c566/enlighten-1.12.4-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ffe901f7161ca7dfc693530441af1a4de664e9e3d487e02cd6ba50dfd55b7fba",
                "md5": "9a8c007716426285a9a5e27cb0652488",
                "sha256": "75f3d92b49e0ef5e454fc1a0f39dc0ab8f6d9946cbe534db3ded3010217d5b5f"
            },
            "downloads": -1,
            "filename": "enlighten-1.12.4.tar.gz",
            "has_sig": false,
            "md5_digest": "9a8c007716426285a9a5e27cb0652488",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 67390,
            "upload_time": "2023-12-25T21:40:09",
            "upload_time_iso_8601": "2023-12-25T21:40:09.731573Z",
            "url": "https://files.pythonhosted.org/packages/ff/e9/01f7161ca7dfc693530441af1a4de664e9e3d487e02cd6ba50dfd55b7fba/enlighten-1.12.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-25 21:40:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Rockhopper-Technologies",
    "github_project": "enlighten",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "blessed",
            "specs": []
        },
        {
            "name": "prefixed",
            "specs": []
        }
    ],
    "tox": true,
    "lcname": "enlighten"
}
        
Elapsed time: 0.16660s