diff --git a/MANIFEST b/MANIFEST
deleted file mode 100644
index 8ead968..0000000
--- a/MANIFEST
+++ /dev/null
@@ -1,4 +0,0 @@
-# file GENERATED by distutils, do NOT edit
-setup.py
-ZProgressbar/ZProgressbar.py
-ZProgressbar/__init__.py
diff --git a/README.md b/README.md
index 4287c83..ed053a3 100644
--- a/README.md
+++ b/README.md
@@ -1,107 +1,121 @@
-# progressbar
+
+
+
+
+
+
+
+
+ ### py-bar
+
+
+ Python ASCII Progress Bar
+
+
+ [![Version](https://img.shields.io/badge/dynamic/json.svg?label=Version&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/py-bar/tags&query=$[0].name)](https://git.zakscode.com/ztimson/py-bar/tags)
+ [![Pull Requests](https://img.shields.io/badge/dynamic/json.svg?label=Pull%20Requests&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/py-bar&query=open_pr_counter)](https://git.zakscode.com/ztimson/py-bar/pulls)
+ [![Issues](https://img.shields.io/badge/dynamic/json.svg?label=Issues&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/py-bar&query=open_issues_count)](https://git.zakscode.com/ztimson/py-bar/issues)
+
+
+
+ ---
+
+
+ ---
+
+
+## Table of Contents
+- [py-bar](#top)
+ - [About](#about)
+ - [Built With](#built-with)
+ - [Setup](#setup)
+ - [Production](#production)
+ - [Documentation](#documentation)
+ - [License](#license)
+
+## About
+
Python CLI Progress bar. This module is an iterator that can not only, iterate, but display its self as a progressbar along with some other usefull iformation such as iterations a second, estimated time, elapsed time, etc.
`00:25 100% [====================] [100/100] 3.99/s 00:00`
-### Authors
- * [Zak Timson](http://zakscode.com)
+### Built With
+[![Python](https://img.shields.io/badge/Python-FFD43B?style=for-the-badge&logo=python)](https://www.python.org/)
-### License
-GNU GENERAL PUBLIC LICENSE, Version 3, 29 June 2007. read LICENSE for more
+## Setup
-### Install
-Copy the script to your project and import it with:
+
+
+
+ Production
+
+
-`import progressbar`
+#### Prerequisites
+- [Python](https://www.python.org/downloads/)
-or
+#### Instructions
+1. Download and add script to project: `curl https://git.zakscode.com/ztimson/py-bar/raw/branch/develop/progressbar.py`
+2. Use in python script:
-`from progressbar import Progressbar`
+```python
+from progressbar import Progressbar
-### Quick Start
-Use in a forloop:
+for i in Progressbar(100):
+ ...
-`for i in Progressbar(100)`
+# OR
-Dont like it auto writing to the stdout? Do it your self.
-
-```
-progress = Progressbar(100, display=False) # display false stops the auto writing
+progress = Progressbar(100, display=False) # Output manually
for i in progress:
- print(str(progress)) # using the to string will maunually write it
+ print(str(progress)) # Print progress bar
+ ...
```
-Maybe you dont want to use it as an iterable and you just want a progressbar. You can manually control its progress. Example, you want to view download progress:
+
-```
-progress = Progressbar(download_size, unit=" MB/s") # create the object
+## Documentation
-...
+### Progressbar
-progress.__iter__() # This will start the clock and initiate the iterable
+#### Constructor Arguments
+| Name | Description |
+|------------|---------------------------------------------|
+| start | Iterator starting position |
+| end | Iterator ending position |
+| current | Current iteration position |
+| step | Added to current index after each iteration |
+| length | ASCII progress bar string length |
+| units | Unit to append to progress rate |
+| color | ANSI escape code to color progress bar |
+| display | Automatically output to sdtout |
+| bar_format | Custom progress bar format string |
-...
+#### Properties
+| Name | Description |
+|------------|----------------------------------------------------|
+| elapsed | Time ellapsed since first iteration: mm:ss |
+| percentage | Percentage of completion: 50% |
+| bar | ASCII progress bar: \|==========\| |
+| fraction | Position as a fraction: \[index/total\] |
+| rate | Iterations per second: 2.00/s |
+| eta | Estimated time until complete: mm:ss |
-progress.current = 220 # set the curent progress ex. 200/1000 Mb downloaded
-download_speed = progress.rate() # get any sort of stistics you may want, the download rate for exmple
-print(progress) # display progress bar. Manually iterating the object it will not display automaticly
-```
+#### Methods
+| Name | Description |
+|----------------------|----------------------------------------------|
+| elapsed(self) | Elapsed time in seconds |
+| estimated_time(self) | Estimated time until completion in seconds |
+| fraction(self) | Create fraction string |
+| generate_bar | Progress bar ASCII string |
+| per_second | Calculate iteration rate per second as float |
+| percentage | Percentage as a floating point |
-This would print (Underscores to maintain spacing):
+## License
+Copyright © 2023 Zakary Timson | Available under the GNU General Public License
-`00:53 20% [====________________] [ 200/1000] 3.75 Mb/s 03:32`
-
-### API
-**Class: Progressbar**
-
-**Attributes**
-
-start - iterator starting position
-
-end - iterator ending position
-
-current - curent iteration
-
-step - number to be added to current each iteraton
-
-length - length of characters in the progress bar
-
-units - unit to append to rate
-
-color - ANSI escape code to change color of text
-
-display - automaticly display the to string with each iteration
-
-bar_format - string which dictates how things are displayed ex "{elapesed} - {eta}" could look like: 00:00 - 00:10. See the statistics portion to see what can be displayed
-
-**Available Statistics**
-
-elapsed - running time of iterator. displayed as: mm:ss
-
-percentage - percentage of completion. displayed as: 100%
-
-bar - the progress bar. displayed as: |==========|
-
-fraction - current / end. displayed as: [100/100]
-
-rate - iterations per second. displayed as: 2.00/s (unit can be changed, see units attribute)
-
-eta - estimated time until completion. displayed as: mm:ss
-
-**Methods**
-
-elapsed(self) - running time of iterator
-
-estimated_time(self) - estimated time until iterator completes
-
-fraction(self) - create string representing the fraction, complete over total
-
-generate_bar - generates the progress bar and returns string
-
-per_second - calculates the rate or speed of iterations per second
-
-percentage - floating point of completion
-
-### Bug Reporting
-
-Please submit bugs to the github [issue tracker](https://github.com/zaktimson/progressbar/issues)
+See the [license](./LICENSE) for more information.
diff --git a/ZProgressbar/ZProgressbar.py b/ZProgressbar/ZProgressbar.py
deleted file mode 100644
index 1db4dcc..0000000
--- a/ZProgressbar/ZProgressbar.py
+++ /dev/null
@@ -1,140 +0,0 @@
-from time import time
-from sys import stdout
-
-
-class ZProgressbar:
- """
- An iterable object that can display statics about its self such as time elapsed, percentage, progress as a fraction,
- iterations per second, estimated time and can generate an ascii progressbar.
- """
-
- def __init__(self, start, end=None, step=1, length=20, unit="/s", color="\033[0;31m", display=True,
- bar_format="{elapsed} {percentage} {bar} {rate} {eta}"):
- """
- Create an iterable object with the following properties. If no end is specified the start is assumed the end.
- :param start: starting position of iterator (inclusive)
- :param end: ending position of iterator (exclusive)
- :param step: how many integers to add each iteration
- :param length: length of the progress bar (default is 20)
- :param unit: unit to display with the rate (default is /s)
- :param color: ANSI escape codes prepended to output to change color (default is \033[0;31m )
- :param display: automatically display statistics on every iteration (default True)
- :param bar_format: format the way statistics are displayed. Components to display are: elapsed, percentage, bar,
- fraction, rate and eta. These keywords are swapped out for the actual information. (default is
- "{elapsed} {percentage} {bar} {rate} {eta}")
- """
- if end is None:
- self.start = 0
- self.end = start
- else:
- self.start = start
- self.end = end
- self.step = step
- self.length = length
- self.unit = unit
- self.color = color
- self.display = display
- self.bar_format = bar_format
-
- def __iter__(self):
- """
- initiate iterator which sets the starting point and gets the current time which is used for statistics
- :return: returns the new object
- """
- self.start_time = time()
- self.current = self.start
- return self
-
- def __next__(self):
- """
- next overload. If display is true the latest stetistics are displayed
- :return: The next number in iterator
- """
- if self.display:
- self.__restart_line()
- stdout.write(str(self))
- stdout.flush()
- if self.current >= self.end:
- raise StopIteration
- self.current += self.step
- return self.current - self.step
-
- def __str__(self):
- """
- displays the iterator as a string of statistics
- :return: formatted string
- """
- return self.color + self.bar_format.format(bar=self.generate_bar(),
- elapsed=self.__time_format(self.elapsed()),
- eta=self.__time_format(self.estimated_time()),
- fraction=self.fraction(),
- percentage=(str(int(self.percentage() * 100)) + "%").rjust(4),
- rate=str(self.per_second()) + self.unit)
-
- def elapsed(self):
- """
- calculate the time that has elapsed
- :return: long elapsed time
- """
- return time() - self.start_time
-
- def estimated_time(self):
- """
- Use the current percentage and elapsed time to determine an ETA
- :return: how much time is left
- """
- try:
- return self.elapsed() / self.percentage() - self.elapsed()
- except ZeroDivisionError:
- return 0
-
- def fraction(self):
- """
- create a fraction representing the progress and the end of the iterator
- :return: string representing current/end of iterator
- """
- return "%s/%d" % (str(self.current).rjust(len(str(self.end))), self.end)
-
- def generate_bar(self):
- """
- creates an ascii progressbar
- :return: string progressbar
- """
- bar = "[{0}]".format(("=" * int(self.percentage() * self.length)).ljust(self.length))
- return bar
-
- def per_second(self):
- """
- use the current number of iterations and the amount of elapsed time to determine how many iterations per second
- :return:
- """
- try:
- return round(self.current / self.step / self.elapsed(), 2)
- except ZeroDivisionError:
- return 0
-
- def percentage(self):
- """
- use current position / (end - start) to calculate percentage of completion
- :return: float of percentage to completion
- """
- return self.current / (self.end - self.start)
-
- @staticmethod
- def __restart_line():
- """
- Writes return carriage to stdout and flushes. This allows writing to the same line.
- :return: None
- """
- stdout.write('\r')
- stdout.flush()
-
- @staticmethod
- def __time_format(time_to_format):
- """
- formats time to mm:ss
- :param time_to_format: long to format
- :return: string of time
- """
- m, s = divmod(time_to_format, 60)
- return "%02d:%02d" % (m, s)
diff --git a/ZProgressbar/__init__.py b/ZProgressbar/__init__.py
deleted file mode 100644
index ed0d2d0..0000000
--- a/ZProgressbar/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from ZProgressbar import ZProgressbar
\ No newline at end of file
diff --git a/__init__.py b/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/dist/ZProgressbar-1.0.tar.gz b/dist/ZProgressbar-1.0.tar.gz
deleted file mode 100644
index 873de3a..0000000
Binary files a/dist/ZProgressbar-1.0.tar.gz and /dev/null differ
diff --git a/dist/ZProgressbar-1.1.tar.gz b/dist/ZProgressbar-1.1.tar.gz
deleted file mode 100644
index 1bb8607..0000000
Binary files a/dist/ZProgressbar-1.1.tar.gz and /dev/null differ
diff --git a/setup.py b/setup.py
deleted file mode 100644
index 52ef45a..0000000
--- a/setup.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from distutils.core import setup
-setup(
- name = 'ZProgressbar',
- packages = ['ZProgressbar'],
- version = '1.2',
- description = 'An iterator that can be displayed as an Ascii progress bar as well as display statistics like speed, progress and estimated time',
- author = 'Zak Timson',
- author_email = 'zaktimson@gmail.com',
- url = 'https://github.com/zaktimson/progressbar',
- download_url = 'https://github.com/zaktimson/progressbar/tarball/1.2',
- keywords = ['iterator', 'progressbar', 'estimated time', 'timer'],
- classifiers = [],
-)
\ No newline at end of file