Contribute to our books#
py-edu-fr is based on few small websites for the trainings. For example, https://py-edu-fr.pages.heptapod.net/py-edu-fr-init is built from the sources hosted here https://foss.heptapod.net/py-edu-fr/py-edu-fr-init.
To learn how to get the source locally and send changes, read Heptapod and Mercurial.
Install and build locally#
One needs to install PDM and make
.
commands |
|
---|---|
|
Local build |
|
Format sources |
|
Start Jupyter Lab |
|
Relock dependencies |
About Jupyter Book and notebooks saved in MySt Markdown#
These “books” are based on Jupyter Book.
The actual source of the book is in a directory
book
(for example https://foss.heptapod.net/py-edu-fr/py-edu-fr-init/-/tree/branch/default/book).The table of content is coded in a file
_toc.yml
(for example https://foss.heptapod.net/py-edu-fr/py-edu-fr-init/-/blob/branch/default/book/\_toc.yml).The configuration of the book in stored in a file
_config.yml
(for example https://foss.heptapod.net/py-edu-fr/py-edu-fr-init/-/blob/branch/default/book/\_config.yml).
Most other files in the book
directory are written in MyST Markdown (extension .md
)
since we use the same extension for
simple Markdown files with static content and
notebooks containing Python cells (stored in MyST Markdown).
The notebooks start with a frontmatter like:
---
jupytext:
formats: md:myst
text_representation:
extension: .md
format_name: myst
format_version: 0.13
jupytext_version: 1.16.7
kernelspec:
display_name: Python 3 (ipykernel)
language: python
name: python3
---
and content input code cells like
```{code-cell} ipython3
for idx in range(4):
print(idx, end=", ")
```
The output of notebooks is not saved in the .md files (which is a sane behavior for us). These notebooks are executed during the book build (with a cache).
Tip
Using Jupyter Lab and Jupytext, one can open and edit the .md files corresponding to
notebooks as standard notebooks. Run make jupyterlab
, right click on a .md notebook
file and choose “Open With -> Notebook”.
This can be very useful to contribute to a notebook and to execute cells interactively during the training.