Skip to content

Conversation

lrq3000
Copy link
Member

@lrq3000 lrq3000 commented Dec 29, 2015

Implements a web-friendly tqdm by using JSS to dynamically redefine JSS. Based on aplavin's great work on ipy-progressbar.

The output is correct, but I don't know how we can test that out (ie, show this in a web page). Someone has an idea?

  • Find a way to test that in an html page.
  • Unit test.
  • Add to readme

Signed-off-by: Stephen L. <lrq3000@gmail.com>
@lrq3000 lrq3000 added the help wanted 🙏 We need you (discussion or implementation) label Dec 29, 2015
@codecov-io
Copy link

Current coverage is 100.00%

Merging #94 into master will not affect coverage as of 1f10ba4

@@            master     #94   diff @@
======================================
  Files            5       6     +1
  Stmts          239     248     +9
  Branches        49      49       
  Methods          0       0       
======================================
+ Hit            239     248     +9
  Partial          0       0       
  Missed           0       0       

Review entire Coverage Diff as of 1f10ba4

Powered by Codecov. Updated on successful CI builds.

def __init__(self, *args, **kwargs):

# Setup default output
if not kwargs.get('file', None) or kwargs['file'] == sys.stderr:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kwargs.get('file', sys.stderr) is sys.stderr

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks. looks like this was copied from the current notebook implementation.
On 18 May 2016 7:11 a.m., "o11c" notifications@github.com wrote:

In tqdm/_tqdm_web.py
#94 (comment):

  •    # Special signal to close the bar
    
  •    if close:
    
  •        display_javascript(fp, '$("#%s").parent().parent().hide()' % html_id)
    
  • return print_status

+class tqdm_web(tqdm): # pragma: no cover

  • """
  • Experimental CSS/JSS web-friendly tqdm!
  • """
  • def init(self, _args, *_kwargs):
  •    # Setup default output
    
  •    if not kwargs.get('file', None) or kwargs['file'] == sys.stderr:
    

kwargs.get('file', sys.stderr) is sys.stderr


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
https://github.com/tqdm/tqdm/pull/94/files/ca411dd998394c72cd977d80a699247cd7b0ea9f#r63649948

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it was extracted from a variant of _tqdm_notebook. Whereas the
current _tqdm_notebook leverages ipywidgets to show and update the progress
bars, this variant defined its own JS+CSS implementation. However, this
implementation was way slower than ipywidgets, hence why I reverted back,
but this could be used for a web implementation of tqdm (the code is
already fully functional, I just need some feedback from a python web dev
on how to implement the API).

2016-05-18 8:55 GMT+02:00 Casper da Costa-Luis notifications@github.com:

In tqdm/_tqdm_web.py
#94 (comment):

  •    # Special signal to close the bar
    
  •    if close:
    
  •        display_javascript(fp, '$("#%s").parent().parent().hide()' % html_id)
    
  • return print_status

+class tqdm_web(tqdm): # pragma: no cover

  • """
  • Experimental CSS/JSS web-friendly tqdm!
  • """
  • def init(self, _args, *_kwargs):
  •    # Setup default output
    
  •    if not kwargs.get('file', None) or kwargs['file'] == sys.stderr:
    

thanks. looks like this was copied from the current notebook
implementation.
… <#m_9057261056133638991_m_1022619018176992888_>
On 18 May 2016 7:11 a.m., "o11c" _@_.***> wrote: In tqdm/_tqdm_web.py <#94
(comment) https://github.com/tqdm/tqdm/pull/94#discussion_r63649948>: >

    • Special signal to close the bar > + if close: > +

    display_javascript(fp, '$("#%s").parent().parent().hide()' % html_id) > + >
  • return print_status > + > + > +class tqdm_web(tqdm): # pragma: no cover >
  • """ > + Experimental CSS/JSS web-friendly tqdm! > + """ > + def
    init(self, _args, *_kwargs): > + > + # Setup default output > + if not
    kwargs.get('file', None) or kwargs['file'] == sys.stderr:
    kwargs.get('file', sys.stderr) is sys.stderr — You are receiving this
    because you are subscribed to this thread. Reply to this email directly or
    view it on GitHub <
    https://github.com/tqdm/tqdm/pull/94/files/ca411dd998394c72cd977d80a699247cd7b0ea9f#r63649948>


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
https://github.com/tqdm/tqdm/pull/94/files/ca411dd998394c72cd977d80a699247cd7b0ea9f#r63653859

@CrazyPython
Copy link
Contributor

@lrq3000 We'll need an intermediary server to communicate between the two. You could use one of the several server frameworks for python (flask, tornado, django, etc.)

@lrq3000
Copy link
Member Author

lrq3000 commented Aug 4, 2016

@CrazyPython Yes we need a server framework to test the bar, but I don't intend the bar to provide the full stack to show the bars in a web page, but rather just the HTML/CSS/JS output that the user can then plug in any server framework of choice. This would limit the maintenance cost for us and also be more generic. If that's possible...

@CrazyPython
Copy link
Contributor

@lrq3000 I was imagining a simple server on localhost

@lrq3000
Copy link
Member Author

lrq3000 commented Aug 5, 2016

Yes of course it's necessary to be localhost so that we can run unit tests,
but I mean that we should use such a server framework only for unit tests,
but the web-friendly tqdm submodule should be server-agnostic so that it
can work everywhere! (in an ideal world haha...).

2016-08-05 0:37 GMT+02:00 CrazyPython notifications@github.com:

@lrq3000 https://github.com/lrq3000 I was imagining a simple server on
localhost


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#94 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABES3scxxr7Jarmp-0gm3mwdpRKFFv48ks5qcmmegaJpZM4G8YwS
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted 🙏 We need you (discussion or implementation) p4-enhancement-future 🧨 On the back burner submodule ⊂ Periphery/subclasses
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants