-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Demo Mode #14
New Demo Mode #14
Conversation
This will either use a special module/function or a special URL at github as the source for the next cells in a notebook. Currently only the notebook version is available. ``` from ipyext.demo import notebook_demo import ipyext.demo notebook_demo(ipyext.demo) notebook_demo(ipyext.demo.demo_example) notebook_demo("<gh_matplotlib>/animation/") notebook_demo("<gh_matplotlib>/animation/animate_decay.py") ```
This is a bit of a hack: the run_cell method is wrapped so that as long as there is demo materialin a buffer, after the execution of the cell, the next cell is set to the next demo material.
3f150d9
to
973dfb2
Compare
And now I have it working in the notebook and in ipython/qtconsole directly... Also added matplotlib examples directly from github... |
Nice! import ipyext.demo
from ipyext.demo import demo
demo(ipyext.demo.demo_example) |
@juhasch yep... Renamed it after I got the ipython version running |
Example and some demo of the demo mode: http://janschulz.github.io/demo_mode_ipython.html |
Looks like it could be really useful. |
Lets see if someone uses it... Having the function here and not in ipython is a little entry barrier :-/ |
name was used multiple times as variable: once for the name of the current content and several times in list comprehensions. On py2, this results in the name variable overwritten...
83da104
to
e339052
Compare
Ok, IMO this is ready if travis gets green... The only open todo is how to handle matplotlib examples, but I tested this and the current approach (aka not splitting it into multiple cells) is the only one which works due to the way they are written (comments with If it is merged I will write demos for the current magics and then lets see if there are some other projects which want to write demos... |
@juhasch a short review and if satisfied a merge would be nice :-) |
Hmm,
|
The first (make) should be fixed (I use make.cmd and RTD something else, so it wasn't catched,,,) |
I can't reproduce the second problem. Could it be that you ran the tests in the docs subdir? |
Adding the extension to The doc is now generated fine. |
there is also |
print(_sum) | ||
|
||
# This lets the `demo(ipyext.demo)` find only the `demo_example`. | ||
# Only modues with that variable will display an overview of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type: modues->modules
Works fine in the notebook. In [4]: demo(ipyext.demo.demo_example)
<IPython.core.display.Javascript object> Would it make sense to return a text representation in this case ? |
You need to use |
How about adding a |
Currently I use the normal |
Curently I don't know any way to detect which frontent is used to run a kernel, so if the demo is used in the defualt mode (=notebook) make it at least output a helpful message if the frontend does not understand the javscript code to insert the new cells. Alos fix some typos...
337c69d
to
c4d9738
Compare
done :-) |
Builds new notebook cells from the source of a function:
Example:
Closes: #13
Todo
demo("<gh_matplotlib>/")
-> prints the wrong thing...get_ipython().events.register("post_run_cell", self.method)
, see here: https://github.com/FrancescAlted/ipython_memwatcher/blob/master/ipython_memwatcher/memwatcher.py#L47