Skip to content

Commit ba18b23

Browse files
committed
Prepare slides
0 parents  commit ba18b23

File tree

8 files changed

+177
-0
lines changed

8 files changed

+177
-0
lines changed

.github/workflows/publish.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
on:
2+
workflow_dispatch:
3+
push:
4+
branches: main
5+
6+
name: Quarto Publish
7+
8+
jobs:
9+
build-deploy:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- name: Check out repository
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Quarto
18+
uses: quarto-dev/quarto-actions/setup@v2
19+
20+
- name: Render and Publish
21+
uses: quarto-dev/quarto-actions/publish@v2
22+
with:
23+
target: gh-pages
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.quarto/
2+
site/

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# ⚡ Jupytext ⚡
2+
3+
Lightning talk at PyData London - 8 June 2025
4+
5+
Compile the slides with `quarto render slides.qmd`.
6+
7+
Read the slides only at [TODO: github.io]

_quarto.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
project:
2+
type: website
3+
output-dir: site

images/jupytext_logo.svg

Lines changed: 8 additions & 0 deletions
Loading

images/jupytext_menu.png

249 KB
Loading

images/new_text_notebook_menu.png

80.6 KB
Loading

slides.qmd

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
---
2+
pagetitle: Jupytext
3+
footer: "Jupytext: Text notebooks that you will love, by Marc Wouts. PyData London, June 8, 2025"
4+
standalone: true
5+
format:
6+
revealjs:
7+
logo: images/jupytext_logo.svg
8+
---
9+
10+
![](images/jupytext_logo.svg){width=80%}
11+
12+
## Jupyter notebooks
13+
14+
Notebooks are amazing for research! And tutorials 😉
15+
16+
<br>
17+
18+
The `.ipynb` format (JSON) may be a bit verbose but overall it is simple, robust and well documented.
19+
20+
<br>
21+
22+
Jupytext: edit^[or store, convert, synchronize etc.] your notebooks as `.py` files^[many more formats are available, including `.md`]
23+
24+
## Text notebooks
25+
26+
Content is almost what you typed!
27+
28+
```python
29+
# %% [markdown]
30+
# This is a markdown cell
31+
32+
# %%
33+
def f(x):
34+
return 3*x+1
35+
```
36+
37+
<br>
38+
39+
::: {.callout-tip}
40+
- Text notebooks can have metadata (but no outputs)
41+
- Multiline comments also works for Markdown
42+
:::
43+
44+
## Why text notebooks?
45+
46+
- Well suited for version control
47+
- Edit and run your notebooks in your IDE
48+
- Turn your notebooks into libraries
49+
- Quality assurance: `pre-commit`, `ruff`, typing etc. just work
50+
51+
::: {.callout-tip}
52+
Text only notebooks are a good fit for
53+
54+
- docs (use the MyST Markdown format)
55+
- and for tutorials (use the `py:percent` format)
56+
:::
57+
58+
## Paired notebooks (edit in Jupyter)
59+
60+
In general you want _paired_ notebooks. A paired notebook is made of two files:
61+
62+
- `notebook.ipynb` is your usual notebook
63+
- `notebook.py` is the text version
64+
65+
<br>
66+
67+
Open either file in Jupyter (they are the same document).
68+
69+
Both files get updated when you save the notebook.
70+
71+
## Paired notebooks (edit in IDE)
72+
73+
Open `notebook.py` in your IDE and edit it. Then re-open the notebook in Jupyter (or reload it), and you will see the edits!
74+
75+
<br>
76+
77+
Input cells are loaded from the `.py` script
78+
79+
Output cells are loaded from the `.ipynb` file.
80+
81+
<br>
82+
83+
::: {.callout-tip}
84+
To force the synchronization outside of Jupyter, use either `jupytext --sync`,
85+
our pre-commit hook, or the community-maintained plugins for VIM and VS Code
86+
:::
87+
88+
## Installation
89+
90+
- `pip install jupytext` or <br>`conda install jupytext -c conda-forge`
91+
- Restart your Jupyter server
92+
93+
<br>
94+
95+
Now `.py` and `.md` files have a notebook icon, and you get a Jupytext sub-menu in Jupyter 🎉
96+
97+
## Creating paired notebooks
98+
99+
Pair one notebook using the Jupytext Menu:
100+
101+
![](images/jupytext_menu.png){.nostretch width=50% height=50%}
102+
103+
Pair all notebooks in the current and child folders with a `jupytext.toml` file
104+
containing e.g. `formats="ipynb,py"`
105+
106+
## Creating text notebooks
107+
108+
Create text only notebooks with the _New Text Notebook_ menu.
109+
110+
![](images/new_text_notebook_menu.png){.nostretch width=80% height=80%}
111+
112+
Open existing text notebooks with a right click^[run `jupytext-config set-default-viewer python markdown` to open `.py` and `.md` files as notebooks by default]
113+
114+
## Jupytext Stats
115+
116+
- Announced 6 years ago (MIT license)
117+
- 30+ programming languages supported
118+
- 98 contributors
119+
- 6.874 GitHub stars
120+
- 1.3M downloads/month on PyPI
121+
122+
## Compatibility
123+
124+
Jupytext is compatible with the following stacks
125+
126+
- Jupyter Lab, Notebook, Hub etc.
127+
- Jupyter Book and especially MyST Markdown
128+
- VS Code: `# %%` scripts (community extension)
129+
- Spyder, VIM (plugin), any editor
130+
- Quarto (`.qmd`) and RStudio (`.Rmd`), Pandoc
131+
- pre-commit

0 commit comments

Comments
 (0)