Metadata-Version: 2.1
Name: light-progress
Version: 0.1.2
Summary: Light progress reporting tool for Python
Home-page: https://github.com/itkr/light-progress
Author: itkr
Author-email: itkrst@gmail.com
License: MIT
Platform: UNKNOWN
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Utilities

Light Progress
==============

This is progress reporting tool for Python

.. code:: python

   n = 42
   with ProgressBar(n) as progress_bar:
       for item in range(n):
           sleep(0.01)
           progress_bar.forward()

.. code:: python

   # [-..............................] 1% (1/42)
   # [===============-...............] 50% (21/42)
   # [===============================] 100% (42/42)

Installation
------------

.. code:: sh

   pip install light-progress

Examples
--------

Pattern 1
~~~~~~~~~

Call ``start`` ``forward`` and ``finish`` yourself.

.. code:: python

   from time import sleep
   from light_progress.commandline import ProgressBar

   n = 42
   progress_bar = ProgressBar(n)
   progress_bar.start()

   for item in range(n):
       sleep(0.01)
       progress_bar.forward()

   progress_bar.finish()

Pattern 2
~~~~~~~~~

Do iterations in ``with``. ``start`` and ``finish`` do not have to be
called explicitly.

.. code:: python

   from time import sleep
   from light_progress.commandline import ProgressBar

   n = 42
   with ProgressBar(n) as progress_bar:
       for item in range(n):
           sleep(0.01)
           progress_bar.forward()

Pattern 3
~~~~~~~~~

Transfer iteration.

.. code:: python

   from time import sleep
   from light_progress.commandline import ProgressBar

   ProgressBar.iteration(range(42), lambda item: sleep(0.01))

Colors
------

+-------------+-------+
| status      | color |
+=============+=======+
| In progress | Blue  |
+-------------+-------+
| Success     | Green |
+-------------+-------+
| Failur      | Red   |
+-------------+-------+

Widgets
-------

``ProgressBar`` can change the display format using ``widget``.

.. code:: python

   from light_progress.commandline import widget

.. code:: python

   widgets = [widget.Bar(bar='=', tip='-'),
              widget.Percentage(),
              widget.Num()]

   ProgressBar.iteration(
       range(42), lambda item: sleep(0.01), widgets=widgets)

   # [===============-...............] 50% (21/42)

.. code:: python

   widgets = [widget.Percentage(),
              widget.Num(),
              widget.Bar(bar='#', tip='>')]

   ProgressBar.iteration(
       range(42), lambda item: sleep(0.01), widgets=widgets)

   # 50% (21/42) [###############>...............]


