diff options
Diffstat (limited to 'python-consloadingbar.spec')
-rw-r--r-- | python-consloadingbar.spec | 655 |
1 files changed, 655 insertions, 0 deletions
diff --git a/python-consloadingbar.spec b/python-consloadingbar.spec new file mode 100644 index 0000000..d11159f --- /dev/null +++ b/python-consloadingbar.spec @@ -0,0 +1,655 @@ +%global _empty_manifest_terminate_build 0 +Name: python-ConsLoadingBar +Version: 3.0.2 +Release: 1 +Summary: Easy to make progress bars +License: MIT License +URL: https://github.com/flamechain/ConsLoadingBar +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/46/63/ceef02054d90d9232876d5e14c0ec17c0aeb00545a51d20d4a1fd3c84542/ConsLoadingBar-3.0.2.tar.gz +BuildArch: noarch + +Requires: python3-termcolor + +%description +# Progress Indicators for Python + + + +<img src="demo.gif" alt="demo" width="600"/> + +### GitHub Page: [flamechain/ConsLoadingBar](https://github.com/flamechain/ConsLoadingBar) + +### Full Docs: [flamechain/ConsLoadingBar/Documentation.md](https://github.com/flamechain/ConsLoadingBar/blob/main/Documentation.md) + +Backwards Compatible Since 3.0.0 + +> ### Note: Please report bugs, give feedback, and make suggestions on my github page + +## Import + +Imported simply: + +```python +import consloadingbar, time # time import is not required, but will be used for eta calculation later +``` + +## Built-In Demo + +You can use [demo.py](https://github.com/flamechain/ConsLoadingBar/blob/main/demo.py), or call SimulateTasks() to see another bult-in demo class. You can read more about how this class works in the full docs [here](https://github.com/flamechain/ConsLoadingBar/blob/main/Documentation.md). + +```python +clb = consloadingbar.SimulateTasks() +``` + +## Progress Indicators + +There are 4 indicators to choose from: + +- ``progressBar`` +- ``progressChar`` +- ``spinner`` +- ``counter`` + +## ProgressBar() + +### Global Params + +| Name | Description | Type | Default | +|-|-|:-:|-| +| barLength | Length of bar in characters | int | 20 | +| useETACalculation | Stall bar depending on current eta | boolean | False | +| taskCount | Total amount of tasks displayed | int | None | +| mainBarChar | Character of the filled-in bar | string | '█' | +| progressPointBarChar | Last character of the filled-in bar | string | None | +| endPointChars | Suffix and prefix of the bar | list | ['|', '|'] | +| title | Title to show when the bar is running | string | 'Running...' | +| emptyBarChar | Character for the non-filled-in bar | string | ' ' | +| maxValue | Max value the bar reaches | float | 100 | +| maxValueLabel | Unit for the current value | string | '%' | + +### Local Params + +| Name | Description | Type | Default | +|-|-|:-:|-| +| percentage | Current percentage complete | int | | +| time_ | Current time passed since start, used for eta calculations | float | None | +| tasksDone | How many tasks done to display | int | 0 | +| lazyLoad | If used, only updates when needed, no tasks or eta displayed | int-bool | None | +| returnString | Return a string value of the bar instead of printing to the console | boolean | False | + +You can use the params from Bar() to customize the look of the bar (see demo) and the params from the method for iter-specific things like current percentage. + +```python +clb = consloadingbar.Bar(useColor=True, taskCount=10) + +start = time.time() + +for i in range(101): + currentTime = time.time() - start + # Do something. For demo purposes you can sleep the program for about 0.01 seconds. + clb.progressBar(i, time_=currentTime, tasksDone=i//10) +``` + +This will display tasks and eta. You can also call the start() method for multiline titles: + +```python +clb.start() +``` + +```txt +Running... + | | 0% [tasks=0/10] +``` + +Or you can use the end() method to show a full bar. This example has useColor enabled. + +```python +clb.end() +``` + +<pre> +<span style="color:green">Finished</span> + |████████████████████| <span style="color:green">100% [tasks=10/10]</span> +</pre> + +## ProgressChar() + +| Name | Description | Type | Default | +|-|-|:-:|-| +| index | Index of phases to print | integer | | +| phases | List of characters that the index calls from | list | [' ', '▁', '▂', '▃', '▄', '▅', '▆', '▇', '█'] | +| title | Title to show while running | string | 'Loading' | + +This shows a character for progress. Like spinner but has a sense of completion. + +```python +clb = consloadingbar.Bar() + +clb.progressChar(1) # Will run for 2 seconds +``` + +```txt +Loading ▁ +``` + +## Spinner() + +| Name | Description | Type | Default | +|-|-|:-:|-| +| stop() | Used if on a seperate thread to call on main to stop | func-bool | False | +| time_ | Instead you can hardcode how long it should take | float | None | +| title | Title to display while running | string | 'Loading' | +| phases | A list of values to loop through to display | list | ['|', '/', '-', '\\'] | False | +| returnString | Used if you want to return the string value instead of print | boolean | False | + +As seen in the demo, you can do lots. Here are a couple examples that are shown in the demo: + +```python +clb = consloadingbar.Bar() + +clb.spinner(time_=2) +``` + +```python +clb.spinner(time_=4.7, phases='preset') +``` + +This last one uses a preset, and the preset takes about 4.7 seconds to complete once. + +## Counter() + +| Name | Description | Type | Default | +|-|-|:-:|-| +| totalTime | Total time for completion | float | | +| start | Start number | float | | +| end | End number | float | | +| title | Title to display | string | 'Loading' | + +Here is how to count up and count down in 2 seconds each: + +```python +clb = consloadingbar.Bar() + +clb.counter(2, start=0, end=100) +clb.counter(2, start=100, end=0) +``` + +This will count up to 100, then back down to 0 + +___ + +## Installation + +Install via pip using `pip install ConsLoadingBar`. + +```bash +pip install ConsLoadingBar +``` + +To make sure you have the current version you can use this command instead: + +```bash +pip install --upgrade ConsLoadingBar +``` + +You can also directly call the module from python: + +```bash +python3 -m pip install ConsLoadingBar +``` + +___ + +## License + +ConsLoadingBar is licensed under the MIT License + + + + +%package -n python3-ConsLoadingBar +Summary: Easy to make progress bars +Provides: python-ConsLoadingBar +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-ConsLoadingBar +# Progress Indicators for Python + + + +<img src="demo.gif" alt="demo" width="600"/> + +### GitHub Page: [flamechain/ConsLoadingBar](https://github.com/flamechain/ConsLoadingBar) + +### Full Docs: [flamechain/ConsLoadingBar/Documentation.md](https://github.com/flamechain/ConsLoadingBar/blob/main/Documentation.md) + +Backwards Compatible Since 3.0.0 + +> ### Note: Please report bugs, give feedback, and make suggestions on my github page + +## Import + +Imported simply: + +```python +import consloadingbar, time # time import is not required, but will be used for eta calculation later +``` + +## Built-In Demo + +You can use [demo.py](https://github.com/flamechain/ConsLoadingBar/blob/main/demo.py), or call SimulateTasks() to see another bult-in demo class. You can read more about how this class works in the full docs [here](https://github.com/flamechain/ConsLoadingBar/blob/main/Documentation.md). + +```python +clb = consloadingbar.SimulateTasks() +``` + +## Progress Indicators + +There are 4 indicators to choose from: + +- ``progressBar`` +- ``progressChar`` +- ``spinner`` +- ``counter`` + +## ProgressBar() + +### Global Params + +| Name | Description | Type | Default | +|-|-|:-:|-| +| barLength | Length of bar in characters | int | 20 | +| useETACalculation | Stall bar depending on current eta | boolean | False | +| taskCount | Total amount of tasks displayed | int | None | +| mainBarChar | Character of the filled-in bar | string | '█' | +| progressPointBarChar | Last character of the filled-in bar | string | None | +| endPointChars | Suffix and prefix of the bar | list | ['|', '|'] | +| title | Title to show when the bar is running | string | 'Running...' | +| emptyBarChar | Character for the non-filled-in bar | string | ' ' | +| maxValue | Max value the bar reaches | float | 100 | +| maxValueLabel | Unit for the current value | string | '%' | + +### Local Params + +| Name | Description | Type | Default | +|-|-|:-:|-| +| percentage | Current percentage complete | int | | +| time_ | Current time passed since start, used for eta calculations | float | None | +| tasksDone | How many tasks done to display | int | 0 | +| lazyLoad | If used, only updates when needed, no tasks or eta displayed | int-bool | None | +| returnString | Return a string value of the bar instead of printing to the console | boolean | False | + +You can use the params from Bar() to customize the look of the bar (see demo) and the params from the method for iter-specific things like current percentage. + +```python +clb = consloadingbar.Bar(useColor=True, taskCount=10) + +start = time.time() + +for i in range(101): + currentTime = time.time() - start + # Do something. For demo purposes you can sleep the program for about 0.01 seconds. + clb.progressBar(i, time_=currentTime, tasksDone=i//10) +``` + +This will display tasks and eta. You can also call the start() method for multiline titles: + +```python +clb.start() +``` + +```txt +Running... + | | 0% [tasks=0/10] +``` + +Or you can use the end() method to show a full bar. This example has useColor enabled. + +```python +clb.end() +``` + +<pre> +<span style="color:green">Finished</span> + |████████████████████| <span style="color:green">100% [tasks=10/10]</span> +</pre> + +## ProgressChar() + +| Name | Description | Type | Default | +|-|-|:-:|-| +| index | Index of phases to print | integer | | +| phases | List of characters that the index calls from | list | [' ', '▁', '▂', '▃', '▄', '▅', '▆', '▇', '█'] | +| title | Title to show while running | string | 'Loading' | + +This shows a character for progress. Like spinner but has a sense of completion. + +```python +clb = consloadingbar.Bar() + +clb.progressChar(1) # Will run for 2 seconds +``` + +```txt +Loading ▁ +``` + +## Spinner() + +| Name | Description | Type | Default | +|-|-|:-:|-| +| stop() | Used if on a seperate thread to call on main to stop | func-bool | False | +| time_ | Instead you can hardcode how long it should take | float | None | +| title | Title to display while running | string | 'Loading' | +| phases | A list of values to loop through to display | list | ['|', '/', '-', '\\'] | False | +| returnString | Used if you want to return the string value instead of print | boolean | False | + +As seen in the demo, you can do lots. Here are a couple examples that are shown in the demo: + +```python +clb = consloadingbar.Bar() + +clb.spinner(time_=2) +``` + +```python +clb.spinner(time_=4.7, phases='preset') +``` + +This last one uses a preset, and the preset takes about 4.7 seconds to complete once. + +## Counter() + +| Name | Description | Type | Default | +|-|-|:-:|-| +| totalTime | Total time for completion | float | | +| start | Start number | float | | +| end | End number | float | | +| title | Title to display | string | 'Loading' | + +Here is how to count up and count down in 2 seconds each: + +```python +clb = consloadingbar.Bar() + +clb.counter(2, start=0, end=100) +clb.counter(2, start=100, end=0) +``` + +This will count up to 100, then back down to 0 + +___ + +## Installation + +Install via pip using `pip install ConsLoadingBar`. + +```bash +pip install ConsLoadingBar +``` + +To make sure you have the current version you can use this command instead: + +```bash +pip install --upgrade ConsLoadingBar +``` + +You can also directly call the module from python: + +```bash +python3 -m pip install ConsLoadingBar +``` + +___ + +## License + +ConsLoadingBar is licensed under the MIT License + + + + +%package help +Summary: Development documents and examples for ConsLoadingBar +Provides: python3-ConsLoadingBar-doc +%description help +# Progress Indicators for Python + + + +<img src="demo.gif" alt="demo" width="600"/> + +### GitHub Page: [flamechain/ConsLoadingBar](https://github.com/flamechain/ConsLoadingBar) + +### Full Docs: [flamechain/ConsLoadingBar/Documentation.md](https://github.com/flamechain/ConsLoadingBar/blob/main/Documentation.md) + +Backwards Compatible Since 3.0.0 + +> ### Note: Please report bugs, give feedback, and make suggestions on my github page + +## Import + +Imported simply: + +```python +import consloadingbar, time # time import is not required, but will be used for eta calculation later +``` + +## Built-In Demo + +You can use [demo.py](https://github.com/flamechain/ConsLoadingBar/blob/main/demo.py), or call SimulateTasks() to see another bult-in demo class. You can read more about how this class works in the full docs [here](https://github.com/flamechain/ConsLoadingBar/blob/main/Documentation.md). + +```python +clb = consloadingbar.SimulateTasks() +``` + +## Progress Indicators + +There are 4 indicators to choose from: + +- ``progressBar`` +- ``progressChar`` +- ``spinner`` +- ``counter`` + +## ProgressBar() + +### Global Params + +| Name | Description | Type | Default | +|-|-|:-:|-| +| barLength | Length of bar in characters | int | 20 | +| useETACalculation | Stall bar depending on current eta | boolean | False | +| taskCount | Total amount of tasks displayed | int | None | +| mainBarChar | Character of the filled-in bar | string | '█' | +| progressPointBarChar | Last character of the filled-in bar | string | None | +| endPointChars | Suffix and prefix of the bar | list | ['|', '|'] | +| title | Title to show when the bar is running | string | 'Running...' | +| emptyBarChar | Character for the non-filled-in bar | string | ' ' | +| maxValue | Max value the bar reaches | float | 100 | +| maxValueLabel | Unit for the current value | string | '%' | + +### Local Params + +| Name | Description | Type | Default | +|-|-|:-:|-| +| percentage | Current percentage complete | int | | +| time_ | Current time passed since start, used for eta calculations | float | None | +| tasksDone | How many tasks done to display | int | 0 | +| lazyLoad | If used, only updates when needed, no tasks or eta displayed | int-bool | None | +| returnString | Return a string value of the bar instead of printing to the console | boolean | False | + +You can use the params from Bar() to customize the look of the bar (see demo) and the params from the method for iter-specific things like current percentage. + +```python +clb = consloadingbar.Bar(useColor=True, taskCount=10) + +start = time.time() + +for i in range(101): + currentTime = time.time() - start + # Do something. For demo purposes you can sleep the program for about 0.01 seconds. + clb.progressBar(i, time_=currentTime, tasksDone=i//10) +``` + +This will display tasks and eta. You can also call the start() method for multiline titles: + +```python +clb.start() +``` + +```txt +Running... + | | 0% [tasks=0/10] +``` + +Or you can use the end() method to show a full bar. This example has useColor enabled. + +```python +clb.end() +``` + +<pre> +<span style="color:green">Finished</span> + |████████████████████| <span style="color:green">100% [tasks=10/10]</span> +</pre> + +## ProgressChar() + +| Name | Description | Type | Default | +|-|-|:-:|-| +| index | Index of phases to print | integer | | +| phases | List of characters that the index calls from | list | [' ', '▁', '▂', '▃', '▄', '▅', '▆', '▇', '█'] | +| title | Title to show while running | string | 'Loading' | + +This shows a character for progress. Like spinner but has a sense of completion. + +```python +clb = consloadingbar.Bar() + +clb.progressChar(1) # Will run for 2 seconds +``` + +```txt +Loading ▁ +``` + +## Spinner() + +| Name | Description | Type | Default | +|-|-|:-:|-| +| stop() | Used if on a seperate thread to call on main to stop | func-bool | False | +| time_ | Instead you can hardcode how long it should take | float | None | +| title | Title to display while running | string | 'Loading' | +| phases | A list of values to loop through to display | list | ['|', '/', '-', '\\'] | False | +| returnString | Used if you want to return the string value instead of print | boolean | False | + +As seen in the demo, you can do lots. Here are a couple examples that are shown in the demo: + +```python +clb = consloadingbar.Bar() + +clb.spinner(time_=2) +``` + +```python +clb.spinner(time_=4.7, phases='preset') +``` + +This last one uses a preset, and the preset takes about 4.7 seconds to complete once. + +## Counter() + +| Name | Description | Type | Default | +|-|-|:-:|-| +| totalTime | Total time for completion | float | | +| start | Start number | float | | +| end | End number | float | | +| title | Title to display | string | 'Loading' | + +Here is how to count up and count down in 2 seconds each: + +```python +clb = consloadingbar.Bar() + +clb.counter(2, start=0, end=100) +clb.counter(2, start=100, end=0) +``` + +This will count up to 100, then back down to 0 + +___ + +## Installation + +Install via pip using `pip install ConsLoadingBar`. + +```bash +pip install ConsLoadingBar +``` + +To make sure you have the current version you can use this command instead: + +```bash +pip install --upgrade ConsLoadingBar +``` + +You can also directly call the module from python: + +```bash +python3 -m pip install ConsLoadingBar +``` + +___ + +## License + +ConsLoadingBar is licensed under the MIT License + + + + +%prep +%autosetup -n ConsLoadingBar-3.0.2 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-ConsLoadingBar -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 17 2023 Python_Bot <Python_Bot@openeuler.org> - 3.0.2-1 +- Package Spec generated |