Skip to content

Notebooks-as-code with Jupytext #307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
3 tasks
edoardob90 opened this issue May 8, 2025 · 1 comment
Open
3 tasks

Notebooks-as-code with Jupytext #307

edoardob90 opened this issue May 8, 2025 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@edoardob90
Copy link
Member

Jupytext is a package and Jupyter extension that provides a very useful way of "pairing" a notebook with a text file in many formats: a Python script, a Markdown, a RestructuredText.

Pairing a notebook from Jupyter creates the chosen text file alongside the notebook file. Any changes made to the text file are reflected in the notebook upon reloading.

I think this is an incredibly useful addition to simplify reviews on GitHub because you can change or suggest changes directly on a text file, instead of an IPython notebook (which is an unreadable JSON).

The notebook and the text file are synced only on save: if you don't reload and save the notebook from Jupyter, the changes are not synced. An even more useful addition is to integrate Jupytext syncing as a pre-commit hook:

repos:
-   repo: https://github.com/mwouts/jupytext
    rev: v1.14.7  # CURRENT_TAG/COMMIT_HASH
    hooks:
    - id: jupytext
      args: [--sync]

Todo

  • Add jupytext as a dependency
  • Enable the JupyterLab extension (Dockerfile)
  • Setup a pre-commit hook
@edoardob90 edoardob90 added the enhancement New feature or request label May 8, 2025
@edoardob90 edoardob90 self-assigned this May 8, 2025
@edoardob90
Copy link
Member Author

edoardob90 commented May 8, 2025

An added benefit is that we can rewrite the toc.py script (#240 and #131) to edit the text files. This is way easier than parsing and editing a Jupyter notebook file directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant