Skip to main content

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

PyPI - Version PyPI - Status Dependents (via libraries.io) PyPI - Python Version Libraries.io dependency status for latest release PyPI - License

Table of Contents

Installation

To install wrapper-bar, use pip.

pip install wrapper-bar==0.1.4

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 and dependencies. 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

Yanked Versions

  • v0.1.2

Project details


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.4.tar.gz (7.3 kB view hashes)

Uploaded Source

Built Distribution

wrapper_bar-0.1.4-py3-none-any.whl (7.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page