Skip to content

Commit

Permalink
feat: Add jupytext support for notebooks (#7)
Browse files Browse the repository at this point in the history
* Add jupytext to requirements and rebuild lock files.
* Add jupytext .ipynb to .py pairing rules to pyproject.toml.
* Convert .ipynb to .py:percent with jupytext.
* Ignore .ipynb files to make versioning easier.
* Apply ruff formatting.
* Add section on using jupytext to README.
  • Loading branch information
matthewfeickert authored Mar 16, 2024
1 parent fce38a0 commit ec4cda7
Show file tree
Hide file tree
Showing 9 changed files with 787 additions and 1,350 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ __pycache__
*.json
venv/
*ipynb_checkpoints
.DS_Store
.DS_Store
*.ipynb
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ When you're ready to run tests, run:
python3 -m pytest
```

## Using `jupytext` with Jupyter notebooks

[`jupytext`](https://jupytext.readthedocs.io/) allows for easier versioning of Jupyter notebooks by saving all of the information that exists in them in [specially formatted](https://jupytext.readthedocs.io/en/latest/formats-scripts.html#the-percent-format) `.py` files and then generating the notebook representation when you [select them in a Jupyter interface](https://jupytext.readthedocs.io/en/latest/text-notebooks.html#how-to-open-a-text-notebook-in-jupyter-lab).
Version the `.py` files as you normally would with any other text file.
To run the `.py` files as Jupyter notebooks, select them in the Jupyter file browser, right click, and then select _Open With → Notebook_.
Any changes made in a Jupyter notebook will be automatically synced to the [paired](https://jupytext.readthedocs.io/en/latest/paired-notebooks.html) `.py` file.

# File breakdown

Here's a short explanation of each file/folder in this template:
Expand Down
Loading

0 comments on commit ec4cda7

Please sign in to comment.