{"id":13658159,"url":"https://github.com/Rockhopper-Technologies/enlighten","last_synced_at":"2025-04-24T08:31:29.697Z","repository":{"id":44354529,"uuid":"104497911","full_name":"Rockhopper-Technologies/enlighten","owner":"Rockhopper-Technologies","description":"Enlighten Progress Bar for Python Console Apps","archived":false,"fork":false,"pushed_at":"2025-04-20T13:30:40.000Z","size":6859,"stargazers_count":498,"open_issues_count":6,"forks_count":24,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-20T13:32:12.903Z","etag":null,"topics":["python"],"latest_commit_sha":null,"homepage":"https://python-enlighten.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Rockhopper-Technologies.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-09-22T16:53:40.000Z","updated_at":"2025-04-17T22:04:15.000Z","dependencies_parsed_at":"2023-02-15T18:16:01.359Z","dependency_job_id":"2be5a601-a3a6-4d4a-86bc-012e4ca11d1d","html_url":"https://github.com/Rockhopper-Technologies/enlighten","commit_stats":{"total_commits":334,"total_committers":7,"mean_commits":"47.714285714285715","dds":0.08982035928143717,"last_synced_commit":"ff3edea639c9d3203568827a2be69cbfea1d95a3"},"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rockhopper-Technologies%2Fenlighten","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rockhopper-Technologies%2Fenlighten/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rockhopper-Technologies%2Fenlighten/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rockhopper-Technologies%2Fenlighten/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rockhopper-Technologies","download_url":"https://codeload.github.com/Rockhopper-Technologies/enlighten/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249903214,"owners_count":21342939,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python"],"created_at":"2024-08-02T05:00:56.896Z","updated_at":"2025-04-24T08:31:29.622Z","avatar_url":"https://github.com/Rockhopper-Technologies.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":".. 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| |Python-Bytes|\n\n.. |docs| image:: https://img.shields.io/readthedocs/python-enlighten.svg?style=plastic\u0026logo=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\u0026logo=github-actions\u0026style=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\u0026logo=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\u0026logo=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\u0026logo=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\u0026logo=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\u0026logo=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\u0026logo=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\u0026logo=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\u0026logo=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\u0026logo=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\u0026logo=Fedora\u0026style=plastic\u0026label=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/epel9?color=lightgray\u0026label=EPEL\u0026logo=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\u0026logo=Debian\u0026style=plastic\u0026label=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\u0026logo=Ubuntu\u0026style=plastic\u0026label=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\u0026label=Anaconda\u0026logo=Conda%20Forge\u0026style=plastic\n    :alt: Latest Conda Forge Version\n    :target: https://anaconda.org/conda-forge/enlighten\n\n.. |Python-Bytes| image:: https://img.shields.io/badge/Python_Bytes_Podcast-Episode_184-D7F9FF?logo=podcastindex\u0026labelColor=blue\u0026style=plastic\n    :alt: Featured on Python Bytes\n    :target: https://pythonbytes.fm/episodes/show/184/too-many-ways-to-wait-with-await\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 \u003chttps://github.com/Rockhopper-Technologies/enlighten/blob/master/examples/demo.py\u003e`__\nin\n`examples \u003chttps://github.com/Rockhopper-Technologies/enlighten/tree/master/examples\u003e`__.\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 \u003chttps://python-enlighten.readthedocs.io/en/stable/api.html#series-color\u003e`_ 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 \u003chttps://python-enlighten.readthedocs.io/en/stable/api.html#counter-format\u003e`_ and the\n`color capabilities \u003chttps://blessed.readthedocs.io/en/stable/colors.html\u003e`_\nof the underlying `Blessed \u003chttps://blessed.readthedocs.io/en/stable\u003e`_\n`Terminal \u003chttps://blessed.readthedocs.io/en/stable/terminal.html\u003e`_.\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}\u003c{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}\u003c{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 \u003c 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}\u003c{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 \u003c 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 \u003chttps://raw.githubusercontent.com/Rockhopper-Technologies/enlighten/master/examples/basic.py\u003e`__ - Basic progress bar\n* `context manager \u003chttps://raw.githubusercontent.com/Rockhopper-Technologies/enlighten/master/examples/context_manager.py\u003e`__ - Managers and counters as context managers\n* `floats \u003chttps://raw.githubusercontent.com/Rockhopper-Technologies/enlighten/master/examples/floats.py\u003e`__ - Support totals and counts that are ``floats``\n* `multicolored \u003chttps://raw.githubusercontent.com/Rockhopper-Technologies/enlighten/master/examples/multicolored.py\u003e`__ - Multicolored progress bars\n* `multiple with logging \u003chttps://raw.githubusercontent.com/Rockhopper-Technologies/enlighten/master/examples/multiple_logging.py\u003e`__ - Nested progress bars and logging\n* `FTP downloader \u003chttps://raw.githubusercontent.com/Rockhopper-Technologies/enlighten/master/examples/ftp_downloader.py\u003e`__ - 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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRockhopper-Technologies%2Fenlighten","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRockhopper-Technologies%2Fenlighten","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRockhopper-Technologies%2Fenlighten/lists"}