Skip to main content

Live rich content slides in jupyter notebook

Project description

IPySlides

DOI Binder PyPI version Downloads

IPySlides is a Python library for creating interactive presentations in Jupyter notebooks. It combines the power of Markdown, LaTeX, interactive widgets, and live variable updates in a single presentation framework.


Features

  • 📊 Support for plots, widgets, and rich media
  • 🎨 Customizable themes and layouts
  • 📱 Responsive design for various screen sizes
  • 📤 Export to HTML/PDF (limited content type)
  • 🎯 Frame-by-frame animations
  • 📝 Speaker notes support
  • 🔄 Markdown, citations and settings files synchronization
  • ✏️ Drawing support during presentations

Quick Start

  1. Install:
pip install ipyslides        # Basic installation
pip install ipyslides[extra] # Full features
  1. Create Slides:
import ipyslides as isd
slides = isd.Slides()

# Add content programmatically
slides.build(-1, """
# My First Slide
- Point 1
- Point 2
$E = mc^2$
""")

# Or use cell magic
%%slide 0
# Title Slide
Welcome to IPySlides!
  1. Run Examples:
slides.docs()  # View documentation
slides.demo()  # See demo presentation

✨ Try it in your browser ✨

Jupyterlite Binder
Binder

Content Types

Support for various content types including:

  • 📜 Extended Markdown, see slides.xmd_syntax
  • 📊 Plots (Matplotlib, Plotly, Altair)
  • 🔧 Interactive Widgets
  • 📷 Images and Media
  • ➗ LaTeX Equations
  • ©️ Citations and References
  • 💻 Auto update variables in markdown
  • 🎥 Videos (YouTube, local)
  • 🎮 Enhanced interactive widgets (with fullscreen support, thanks to anywidget)
import numpy as np
from ipywidgets import HTML

@slides.dl.interact(html = HTML(), amplitude= (0, 2),frequency=(0, 5))
def plot(html, amplitude, frequency):
    x = np.linspace(0, 2*np.pi, 100)
    y = amplitude * np.sin(frequency    * x)
    plt.plot(x, y)
    html.value = slides.plt2html(). value
  • For comprehensive dashbords, subclass DashboardBase or use Dashboard from ipyslides.dashlab:
import numpy as np
import matplotlib.pyplot as plt
from ipywidgets import HTML
from ipyslides.dashlab import Dashboard

dash = Dashboard(
    html = HTML(),
    amplitude = (0, 2),
    frequency = (0, 5),
)

@dash.callback
def plot(self, html, amplitude, frequency):
    x = np.linspace(0, 2*np.pi, 100)
    y = amplitude * np.sin(frequency * x)
    plt.plot(x, y)
    html.value = slides.plt2html().value # can be directly shown on out-main

@dash.callback('out-text')
def text(self, amplitude, frequency):
    print(f"Amplitude: {amplitude}\n Frequency: {frequency}")

dash.set_layout( 
    left_sidebar = ['*ctrl'], # all controls in left sidebar 
    center = ['html','out-.*'], # out-main, out-text collected in center
    pane_widths = [3,5,0]
)
dash.set_css(
    main = { # can also be set via post_init callback
        'grid-gap': '4px', 'margin': '8px',
        '.left-sidebar': {'background': '#eee','border-radius': '8px'},
    },
    center = { # can be set in main through '> .center' selector
        '> *': {'background-color': 'whitesmoke', 'border-radius': '8px','padding':'8px'},
        'grid-template-columns': '5fr 3fr', # side-by-side layout for outputs
        'grid-gap': '4px', # central grid gap
        '> *': {'background-color': 'whitesmoke', 'border-radius': '8px','padding':'8px'}
})
display(dash)

Dashboard Example See more examples in DashLab repository and try it out in

  • And much more!

Export Options

  • HTML Export
    Use slides.export_html to build static slides that you can print to PDF. Read export details in settings panel, where you can also export with a single click.

  • PDF Export Support for direct PDF printing from slides using Ctrl + P (use options in side panel to prepare for print) is available, although some IDEs like VSCode may not allow it. Use Save as PDF option and enable background graphics if necessary. If issues arise in direct printing, consider exporting to HTML first and printing from there.

Navigate to Documentation to see HTML slides which you can print to PDF. See demo.pdf for an example exported PDF.


Advanced Features

  • Custom Objects Serialization:

    • You can serialize custom objects to HTML using Slides.serializer API.
    • You can extend markdown syntax using Slides.extender API. See some good extensions to add from PyMdown.
  • Speaker Notes: Enable via Settings Panel → Show Notes and add notes via slides.notes.

  • Custom Styling:

slides.set_css({ # on all slides or slide[index,].set_css() per slide
    'p': {'font-size':'1.2em', 'line-height':'1.5em'}, # relaxed paragraph
}, bg1 = '#f0f0f0') # set theme color on this slide
  • File Sync: Live edit a linked markdown file that updates slides in real-time using slides.sync_with_file.

  • Content Animations:

    • Slides builders now support skeleton animation automatically for a premium editing experience.
    • Beside slides switch transitions, you can animate content anywhere in slides using anim- prefixed classes and related varaiables. See slides.css_animations for details.

Caveats

  1. Markdown Cells:

    • Jupyter markdown cells are not processed by IPySlides
    • Instead, you can use %%slide number -m cell magic and link an external markdown file using slides.sync_with_file
  2. Slide Numbering:

    • Use -1 for automatic slide numbering
    • Manual numbering requires careful tracking to avoid overwriting slides
  3. Speaker Notes:

    • Experimental feature - use with caution
    • Notes appear at top of slide in PDF to grab speaker's attention and are meant for speaker reference only, e.g. printed handout.
    • Place extended projector on top/bottom of laptop screen while presenting in Jupyter Notebook to allow right/left edges click navigation work smoothly.

Development

git clone https://github.com/asaboor-gh/ipyslides.git
cd ipyslides
pip install -e .

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


Documentation

Acknowledgements


Made with ❤️ by Abdul Saboor

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

ipyslides-6.9.9.tar.gz (172.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ipyslides-6.9.9-py2.py3-none-any.whl (226.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file ipyslides-6.9.9.tar.gz.

File metadata

  • Download URL: ipyslides-6.9.9.tar.gz
  • Upload date:
  • Size: 172.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.13

File hashes

Hashes for ipyslides-6.9.9.tar.gz
Algorithm Hash digest
SHA256 65526ad6890443f46e0761596bf75bb6dcd0d99924c16af42a90d7ecde0cb73a
MD5 787d85d629b35ff5f0eef1cccad62574
BLAKE2b-256 d3874afbd0f68707f7c6f10218b653453c0751e12fa6c1d3a8aae53de6461252

See more details on using hashes here.

File details

Details for the file ipyslides-6.9.9-py2.py3-none-any.whl.

File metadata

  • Download URL: ipyslides-6.9.9-py2.py3-none-any.whl
  • Upload date:
  • Size: 226.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.13

File hashes

Hashes for ipyslides-6.9.9-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e7916fb9e9e99cf9f10bf6974652f19c2383fb935b0251aef415a0fb79ee948d
MD5 fbf555225db62b77dbfa9458f3126015
BLAKE2b-256 bbcaaee167f1ed54732f5f2d4cb6e5b3f6c4f5c043a1aeb4e9d411506b3ed22a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page