Progress Bar with command wrapping
Project description
Overview
Wrapper-Bar
is a python module to help wrap commands with the progress bar. Wrapper-Bar
helps in wrapping shell commands, or even python scripts with a progress bar and ETA.
Badges
Table of Contents
Installation
To install wrapper-bar
, use pip.
pip install wrapper-bar==0.1.3
Usage
-
Import the Wrapper class.
>>> from wrapper_bar.wrapper import Wrapper
-
Initialize the Wrapper Class.
>>> wrapControl = Wrapper(*params) # for parameters, check docstring.
-
Docstring
# to check docstring, in terminal/CMD, run: $ pydoc wrapper_bar.wrapper.Wrapper
-
Methods
-
decoy
>>> wrapControl.decoy(*params) # parameters are in the docstring. # decoy is for creating empty progressbar.
-
shellWrapper
>>> wrapControl.shellWrapper(*params) # parameters are in the docstring. # shellWrapper can wrap list of shell commands across the progressbar.
-
pyWrapper
>>> wrapControl.pyWrapper(*params) # parameters are in the docstring. # pyWrapper can wrap list of python scripts across the progressbar.
-
pyShellWrapper
>>> wrapControl.pyShellWrapper(*params) # parametes are in the docstring. # pyShellWrapper can wrap inline python code across a progressbar.
Working of
pyShellWrapper
:-
pyShellWrapper
takes two compulsory parameters =>pythoncodes
anddependencies
. To explain them, let us see below# pythoncodes and dependencies can have any python code except # return, print or yield statements. # let us take this as an example: >>> pythoncodes = ["""a = b+c""", """b=c+d"""] # Now for the above python codes, values of 'b', 'c' and 'd' # are a dependency. Therefore >>> dependencies = ["""b=10""", """c=10\nd=20\n"""] # try to keep one statement only inside """...""", # but if need be, then you can also put multiple # statements followed by '\n'. Like """c=10\nd=20\n""" # and now we will execute them with the loading bar as the # front. >>> from wrapper_bar.wrapper import Wrapper >>> w = Wrapper("Loading:") >>> w.pyShellWrapper(pythoncodes, dependencies) # this will output the following: Loading: |▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓|Time: 0:00:10 # To fetch the outputs, we will use a property 'pyShellWrapperResults' # defined under the `Wrapper Class` >>> a = w.pyShellWrapperResults['a'] # this will be 20 >>> b = w.pyShellWrapperResults['b'] # this will be 30
-
-
Uninstall
To uninstall wrapper-bar
, use pip.
pip uninstall wrapper-bar
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
wrapper_bar-0.1.3.tar.gz
(5.9 kB
view hashes)
Built Distribution
Close
Hashes for wrapper_bar-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f2d8e9b1c329edffea4297ad179390b2e754cdf3c13ad17bdd1025dfcbe5b48 |
|
MD5 | 705adf42618b2da0ce32ad0dd27889a6 |
|
BLAKE2b-256 | 7f5f2650ec60edb4f2010da4fde9cf3edead4285acd887956403da294483314d |