Coder Social home page Coder Social logo

evfro / ipypb Goto Github PK

View Code? Open in Web Editor NEW
40.0 40.0 3.0 49 KB

Python progress bar with rich output that uses native ipython functionality. Widget-free. Works even in JupyterLab.

License: MIT License

Python 100.00%
ipython jupyter-notebook jupyterlab native progress progress-bar progressbar

ipypb's People

Contributors

evfro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

ipypb's Issues

manual flow control with ipypb

Input:

from ipypb import track

pb = track(total=10)
pb.update()

Error:

    216 
    217     def update(self, *args, **kwargs):
--> 218         time_delta = timer() - self.last_updated
    219         # control refresh rate
    220         if (time_delta >= self.update_interval) or (self._progress == self.total):

TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'

There should be some way to initialize a timer for manual updating. Ideally, the first step just should be out of time statistics, and timer to be initialized at first update.

No updates when updates arrive in bursts

Due to below line in the code, the updates do not arrive when they come in bursts.
In practice, I encountered a case where 3/4 of the process happened immediately (due to caching), but the progress bar stayed at 0 for the next hour.

if (time_delta >= self.update_interval) or (self._progress == self.total):

Instead of only basing updates based on time, perhaps it would be good to also update if the progress was significantly changed or maybe just based on the progress difference instead of time? I think updates based on the amount of progress - say at least 1/4000th of progress - might make sense, because most displays cannot display more than 4000 pixels in the width anyway.

Add docstring documentation for all arguments

Currently, the track function docstring only describes the total parameter:

track(iterable=None, total=0, keep=True, cycle=False, label=None)
Docstring:     
Progressbar supports displaying a progressbar like element 
    
Init docstring:
Creates a new progressbar

Parameters
----------
total : int
    maximum size of the progressbar

Please consider adding a brief description of the remaining parameters to the docstring. This helps developers to understand how to use the library.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.