Live rich content slides in jupyter notebook
Project description
IPySlides
Create Interactive Slides in Jupyter/Voila with all kind of rich content.
See PDF-Slides
Changelog
Content below assumes you have ls = LiveSlides()
.
1.0.9
ls.source
now let you capture source code into a variable and do not show bydefault, but this way you can write source code anywhere you want.
with ls.source() as src:
x = do_something()
write(x,src) #will be displayed in two side by side columns, it was not that flexible before
- Even if you do not explicitly assign
ls.source() as s:
, you can still access current code block usingls.current_source
. ls.get_cell_code
will be deprecated in future in favor of verstilels.source
.- Theming is modified a little bit and a new
Fancy
theme is added. - Bug fixes and improvements in CSS.
1.0.7
- Layout/Functionality is fixed for RetroLab which will be base for classical notebook version 7 in future.
ls.sig(callable)
displays signature andls.doc(callable)
display signature alongwith docs in contrast towrite(callable)
directly which displays code as well.
1.0.5
ls.image
now acceptsim = PIL.Image.open('path')
object and displays ifim
is not closed. You can displaynumpy.array
fromnumpy
oropencv
image by converting it toPIL.Image.fromarry(array)
or usingplt.imshow(array)
on it and thenwrite(plt.gcf())
.html_node
function is added to separaetly add HTML without parsing it. It can display itself if on the last line of notebook's cell or can be passed towrite
,ihtml
commands as well.
1.0.4
- Laser pointer 🔴 is added, you can customize it's color in custom theme.
ipyslides.initialize
now has argumentmarkdown_file
. You can write presentation from a markdown file. Slides separator is---
(three dashes). For example:
_________ Markdown File Content __________
# Talk Title
---
# Slide 1
---
# Slide 2
___________________________________________
This will create two slides along with title page.
ls.enable_zoom(object)
will zoom that object when hovered on it whileZoom Items
button is ON (orZ
pressed in Jupyterlab)ls.raw
will print a string while preserving whitspaces and new lines.ls.svg
,ls.image
(ls.file2image is just an alias now for ls.image) can now take url or data to display image.ls.repeat
can be used to remind you of something via notification at given time interval. You can infact create a timer with combination ofls.repeat
andls.notify
.- Besides just matplotlib's figure, now everything inside
ls.image
,ls.svg
,ls.enable_zoom
will go full screen on hover withZoom Items
toggle button ON.
1.0.3
- Now you can send notificatios based on slide using
@ls.notify_at
decorator. This is dynamic operation, so if you need to show time during slides(look at demo slide), it will show current time. Notifications are hidden during screenshot by app's mechanism, not external ones. You can turn ON/OFF notifications from settings panel. - Use
Save PNG
button to save all screenshots in a folder in sequence. You can create aPowerpoint Presentation
from these picture by following instructions in side panel or from the generated fileMake-PPT.md
along pictures.
1.0.2
- Javascript navigation works now after browser's refresh.
- User can now decide whether to display slides inline or in sidebar using a button in Jupyterlab. (Sorry other IDEs, you are not flexible to do this, use Voila in that case.)
- Multiple views of slides can capture keyboard events separately.
- All instances of LivSlides are now aware of each other for theme switch and inline/sidebar toggle. If one instance go in sidebar, others fall to inline. If one go fullscreen, others go minimized.
- Bugs fixed and improvements added.
1.0.1
- Animations now have slide direction based on going left or right.
ipysides.data_variables.animations
now haveslide_h
andslide_v
for horizontal and vertical sliding respectively. - You can now set text and code fonts using
ls.set_font_family(text_font, code_font)
. - Many bugs fixed including Voila's static breakpoint.
1.0.0
ipyslides.initialize(**kwargs)
now returns aLiveSlides
instance instead of changing cell contents. This works everywhere including Google Colab.LiveSlides
,initialize
andinit
cause exit from a terminal which is not based onIPython
.- Markdown and other than slides output now does not appear (height suppressed using CSS) in Voila.
- Keyboard vavigation now works in Voila. (Tested on Voila == 0.2.16)
- Test and add slides bounding box form slides left panel's box using
L,T,R,B
input and see screenshot immediately there. This is in addition and independent tols.set_print_settings(bbox)
.
0.9.9
- Javascript navigation is improved for Jupyterlab.
- The decorator
ls.slides
is renamed asls.frames
and now it adds one slide with many frames. This is useful to reveal slide contents in steps e.g. bullet points one by one.
0.9.8
- PDF printing is optimized. See PDF-Slides. You can hover over top right corner to reveal a slider to change view area while taking screenshot. Also you can select a checkbox from side panel to remove scrolling in output like code.
- You can now display source code using context manager
slides.source
. - You can (not recommended) use browser's print PDF by pressing key
P
in jupyterlab but it only gives you current slide with many limitations, e.g. you need to collect all pages manually.
0.9.6
- Code line numbering is ON by default. You can set
ls.code_line_numbering(False)
to turn OFF. - Add slides in for loop using
slides.enum_slides
function. It create pairs of index and slides.
PDF Printing (Tested on Windows)
- PDF printing is now available. Always print in full screen or set
bbox
of slides. Read instructions in side panel. PDF-Slides
0.9.5
- You can now give
function/class/modules
etc. (without calling) inwrite
and source code is printed. - Objects like
dict/set/list/numpy.ndarray/int/float
etc. are well formatted now. - Any object that is not implemented yet returns its
__repr__
. You can alternatively show that object usingdisplay
or library's specific method.
0.9.4
- Now you can set logo image using
ls.set_logo
function. - LaTeX's Beamer style blcoks are defined. Use
ls.block(...,bg='color')
, or with few defined colors likels.block_r
,ls.block_g
etc. @ls.slides
no more support live calculating slides, this is to avoid lags while presenting.
0.9.3
- Add custom css under %%slide as well using
ls.write_slide_css
. - Slides now open in a side area in Jupyterlab, so editing cells and output can be seen side by side. No more need of Output View or Sidecar.
0.9.1
- In Jupyterlab (only inline cell output way), you can use
Ctrl + Shift + C
to create consoles/terminals, set themes etc. - Use
Ctrl + Shift + [
,Ctrl + Shift + ]
to switch back and forth between notebooks/console/terminals and enjoy coding without leaving slides!
0.8.11
- All utilities commnads are now under
LiveSlides
class too, so you can use eitheripyslides.utils.command
orls.command
forcommand
inwrite
,iwrite
,file2code
etc.
0.8.10
- You can add two slides together like
ls1 + ls2
, title ofls2
is converted to a slide inplace. - You can now change style of each slide usig
**css_props
in commands like@ls.slides
,with ls.slide
andwith ls.title
. - A new command
textbox
is added which is useful to write inline references. Same can be acheived withslides.cite(...here=True)
. - You can use
ls.alert('text')
,ls.colored('text',fg,bg)
to highlight text.
0.8.7
- Support added for objects
matplotlib.pyplot.Figure
,altair.Chart
,pygal.Graph
,pydeck.Deck
,pandas.DataFrame
,bokeh.plotting.Figure
to be directly inwrite
command. write
command now can acceptlist/tuple
of content, items are place in rows.
0.8.5
@ls.slides(...,calculate_now=True)
could be used to calculate slides in advance or just in time. Default isTrue
.- You can now use
ipyslides.utils.iwrite
to build complex layout of widgets like ipywidgets, bqplot etc. (and text usingipyslides.utils.ihtml
).
0.8.3
- You can now use
ls.cite
method to create citations which you can write at end byls.write_citations
command. ls.insert_after
no longer works, use
@ls.slides(after_slide_number,*objs)
def func(obj):
write(obj) #etc. for each obj in objs
decorator which is more pythonic way.
0.8.0 +
Note: All these points may not or only partially apply to earlier versions. So use stable API above version 8.
- Before this version, slides were collected using global namespace, which only allowed one presentation per notebook. Now slides are stored in local namespace, so no restriction on number of slides per notebook.
- To acheive local namespace, functions are moved under class LiveSlide and it registers magics too. So now you will
be able to use
%%slide, %%title
magics. Now you will use context managers as follows
ls = LiveSlides()
ls.convert2slides(True)
with ls.title():
...
with ls.slide(<slide number>):
...
ls.insert_after(<slide number>,*objs, func)
ipyslides.initialize()
can write all above code in same cell.
Note: For LiveSlides('A'), use %%slideA, %%titleA, LiveSlides('B'), use %%slideB, %%titleB so that they do not overwite each other's slides.
-
You can elevate simple cell output to fullscreen in Jupyterlab >= 3.
-
with ls.slide
content manager is equivalent to%%slide
so make sure none of them overwrite each other. -
Auto refresh is enabled. Whenever you execute a cell containing
%%title
,with ls.title
,%%slide
,with ls.slide
orls.insert_after
, slides get updated automatically. -
LiveSlides should be only in top cell. As it collects slides in local namespace, it can not take into account the slides created above itself.
Install
> pip install ipyslides>=0.8
For development install, clone this repository and then
> cd ipyslides
> pip install -e .
Editable Demo
See a Demo Notebook at Kaggle. You can edit it yourself.
For jupyterlab >= 3, do pip install sidecar for better presenting mode.
Content Types to Embed
You can embed anything that you can include in Jupyter notebook like ipywidgets,HTML,PDF,Videos etc.,including jupyter notebook itself!
Note: Websites may refuse to load in iframe. Note: You can embed one intsnace of slides
ls1' inside other instance
ls2' usingls2.insert_after(<N>,ls1.box)
. This is very cool.
IPython Display Objects
Any object with following methods could be in write
command:
_repr_pretty_
, _repr_html_
, _repr_markdown_
, _repr_svg_
, _repr_png_
, _repr_jpeg_
, _repr_latex_
, _repr_json_
, _repr_javascript_
, _repr_pdf_
Such as IPython.display.<HTML,SVG,Markdown,Code>
etc. or third party such as plotly.graph_objects.Figure
.
Plots and Other Data Types (0.8.7+)
These objects are implemented to be writable in write
command:
matplotlib.pyplot.Figure
, altair.Chart
, pygal.Graph
, pydeck.Deck
, pandas.DataFrame
, bokeh.plotting.Figure
.
Many will be extentended in future. If an object is not implemented, use display(obj)
to show inline or use library's specific command to show in Notebook outside write
.
Interactive Widgets
Any object in ipywidgets
or libraries based on ipywidgtes
such as bqplot
,ipyvolume
,plotly's FigureWidget
can be included in iwrite
command. Text/Markdown/HTML inside iwrite
is made available through ihtml
command.
Full Screen Presentation
-
Jupyterlab 3.0+ has full screen eneabled from any view:
- Direct output of cell can be turned into fullscreen.
- Linked output view using
Create New Output View
command is very useful, so you can edit and see output right there. - If you have installed Jupyterlab-Sidecar, slides automatically open in it.
-
Use Voila for full screen prsentations. Your notebook remains same, it is just get run by Voila, may not work as expected.
-
Slides in Jupyter Lab are theme aware in
Inherit
theme mode, so theme of slides changes based on editor theme.
Known Limitations
- Since
ipyslides
is built on ipywidgets and slides are displayed usingOutput
widget, We do not have option to launch two windows to make speakernotes. IfOutput
widget get enabled to function in multiwindows, we will introducespeaker notes
. - Slide number is necessary to be tracked by user, as notebook cells are not linked to each other and multiple runs of a cell can lead to adding many slides with same content.
- Bounding box of slides for screenshots should be set by user (if not in fullscreen), because javascript returns browser window cooordinates only.
Very thankful to Python-Markdown which enabled to create
write
command as well as syntax highliting.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for ipyslides-1.0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14606cd9122ecea56d90de7968bedaa952ba70a5510f24b3d461938f80be63ad |
|
MD5 | fe802d3c3329428733b88f9248ea0942 |
|
BLAKE2b-256 | 1844ae0c41c64cae432a2283c2fe977c79eae9c21061e99f3176843c42e6f5df |