Skip to content

Several mechanisms to time and view progress of execution/runtime delays in Python

License

Notifications You must be signed in to change notification settings

ew98/delayviewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DelayViewer

DelayViewer is a Python assistant for showing progress info visually within the shell running a python command with long exposure. This library provides a simple spinner graphic and a stopwatch. The predominant use case is to display progress for sections within a decorated function.

Installation

Use the package manager pip to install delayviewer.

pip install delayviewer

Spinner Usage

from delayviewer.spinner import handle_spinner
import time

@handle_spinner
def test_spinner(spinner=None):
    spinner.start('delaying 5 sec')
    time.sleep(5)
    spinner.stop()

test_spinner()

Stopwatch Usage

from delayviewer.stopwatch import handle_stopwatch
import time

@handle_stopwatch
def test_stopwatch(stopwatch=None):
    stopwatch.start('clocking 5 sec')
    time.sleep(5)
    stopwatch.stop('Finished timing!')

test_stopwatch()

CLI Utility

The following CLI is included with this package for testing the various progress and timing indicators.

# dlyview -h
usage: dlyview [-h] {spinner,stopwatch,time.show,sleep.ticks} ...

-.-.-. Delay viewer elements for python scripts

positional arguments:
  {spinner,stopwatch,time.show,sleep.ticks}
    spinner             test Spinner graphic for viewing thru execution delays
    stopwatch           test StopWatch for viewing thru execution delays
    time.show           test time show wrapper
    sleep.ticks         test sleeping ticks progress viewer

options:
  -h, --help            show this help message and exit

.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.

License

MIT

Acknowledgements

Thanks to several posts on StackOverflow regarding basic Spinner class implementation. Took that concept and generated the Stopwatch class to mimic behavior.

About

Several mechanisms to time and view progress of execution/runtime delays in Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages