Presento
A tool to programmatically build slides.
Using the excellent reveal.js library, this script helps you generate slides from Python.
You can easily create markdown slides or insert charts as HTML with Plotly.
Install
pip install presento
or use PDM, Poetry, etc...
Example
import plotly.express as px
from markdown import markdown
import presento
p = presento.Presentation(
theme="dracula",
extra_style="""
.reveal h2{
color: #afee34;
}""",
)
p.add_md_slide(
"""
# title of the slide
This is a slide added directly to the presentation.
It uses markdown so it can have:
1. __formatting__
2. [links](https://en.wikipedia.org/wiki/Markdown)
3. lists
""",
extra_style="text-align: left;",
)
# for the next slide we use plotly, but we need a CDN
p.add_cdn_js("https://cdn.plot.ly/plotly-latest.min.js")
fig = px.scatter(x=range(10), y=range(10))
p.add_html_slide(fig.to_html(include_plotlyjs=False, full_html=False))
p.add_columns_slide(
[
markdown("This is a column on the left"),
fig.to_html(include_plotlyjs=False, full_html=False),
# markdown("This is another column, on the right"),
]
)
# p.save_folder('my_slides')
p.show(port=8090)
In this example you can see that in addition to markdown slides you can add verbatim HTML, useful for example to add Plotly charts.
For Plotly (and pretty much every other library) you will want to use a CDN to load the JS once and reuse it across slides. This can be done with add_cdn_js.
The function add_columns_slide is an helper to generate a grid layout with the provided.
The show() method will start a server and open the browser for you.
The save_folder(path) method writes the slides to a folder, that can be statically served.
Theming
When creating the Presentation object, you can pass a theme parameter corresponding to the name of one of the Reveal themes. To create your own theme you need to follow the instructions on the Reveal.js website and replace it on the generated
Metadata
Release files for presento 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| presento-0.3.0.tar.gz | 2.7 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| presento-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.4 MB
Release files / presento-0.3.0.tar.gz
| Download URL | presento-0.3.0.tar.gz |
|---|---|
| Size | 2.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
76eae4be78324dde5afcda2d16a0a01dc8faa117a54a1f07345ed4886dd4b354
|
|
BLAKE2b-256 checksum How to use checksums |
c71063b44234198b7b279d46a93e2bc16017d98ce5486e8708719bb560e89209
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.4.8 CPython/3.11.2
|
Release files / presento-0.3.0-py3-none-any.whl
| Download URL | presento-0.3.0-py3-none-any.whl |
|---|---|
| Size | 2.7 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4b8ef59eb401892f4259631cb03fabc8ae01335324bf5b16d054b6601295fd35
|
|
BLAKE2b-256 checksum How to use checksums |
0c83accf42fa1e22f1e24b3f9206e4314ffb0ef3bb2111c92fdf00c893a962d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.4.8 CPython/3.11.2
|