Skip to content

Notebooks-as-code with Jupytext #307

Open
@edoardob90

Description

@edoardob90

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions