Skip to content

Commit 25751e1

Browse files
authored
Change to py:percent notebooks for docs (#5)
* ✨ change to py:percent notebooks - use "text" based (not json) format notebooks (py:percent) - done through jupytext * ✨ add dev dependencies
1 parent 2023030 commit 25751e1

File tree

8 files changed

+44
-97
lines changed

8 files changed

+44
-97
lines changed

.github/workflows/cicd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,4 @@ jobs:
126126
# remove repository key to set the default to pypi (not test.pypi.org)
127127
repository-url: https://test.pypi.org/legacy/
128128
user: __token__
129-
password: ${{ secrets.PYPI_API_TOKEN }}
129+
password: ${{ secrets.PYPI_API_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ _build
2020
_static
2121
_templates
2222
/docs/reference
23+
/docs/jupyter_execute
2324

2425
# MacOS automatically creates these files
2526
.DS_Store

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ docs\conf.py:
124124
Install package so that new code is picked up in a restared python interpreter:
125125
126126
```
127-
pip install -e .
127+
pip install -e ".[dev]"
128128
```
129129
130130
## TestPyPI
@@ -143,4 +143,4 @@ The documentation is build using readthedocs automatically. See
143143
[project on Readthedocs](https://readthedocs.org/projects/rasmussenlab-python-package/).
144144
145145
- make sure to enable build from PRs in the settings (advanded settings)
146-
- checkout configuration file: [`.readthedocs.yaml`](.readthedocs.yaml)
146+
- checkout configuration file: [`.readthedocs.yaml`](.readthedocs.yaml)

docs/conf.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,22 @@
5656
# Rendering
5757
nb_merge_streams = True
5858

59+
# https://myst-nb.readthedocs.io/en/latest/authoring/custom-formats.html#write-custom-formats
60+
nb_custom_formats = {".py": ["jupytext.reads", {"fmt": "py:percent"}]}
61+
5962
# Add any paths that contain templates here, relative to this directory.
6063
templates_path = ["_templates"]
6164

6265
# List of patterns, relative to source directory, that match files and
6366
# directories to ignore when looking for source files.
6467
# This pattern also affects html_static_path and html_extra_path.
65-
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
68+
exclude_patterns = [
69+
"_build",
70+
"Thumbs.db",
71+
".DS_Store",
72+
"jupyter_execute",
73+
"conf.py",
74+
]
6675

6776

6877
# Intersphinx options

docs/index.rst

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,24 @@
1-
.. mockup documentation master file, created by
2-
sphinx-quickstart on Mon Aug 28 14:09:15 2023.
3-
You can adapt this file completely to your liking, but it should at least
4-
contain the root `toctree` directive.
5-
61
The mockup package
7-
==================================
2+
==================
83

94
Mockup is a Python package with some simple example code.
105
To get started, explore the :class:`mockup.Circle` class.
116

127

138

149
.. toctree::
10+
:hidden:
1511
:maxdepth: 2
1612
:caption: Tutorial
1713

1814
tutorial/tutorial
1915

2016
.. toctree::
17+
:hidden:
2118
:maxdepth: 2
2219
:caption: Contents:
2320

24-
reference/modules
21+
reference/mockup
2522

2623
.. toctree::
2724
:hidden:

docs/tutorial/tutorial.ipynb

Lines changed: 0 additions & 83 deletions
This file was deleted.

docs/tutorial/tutorial.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# %% [markdown]
2+
# # Mockup tutorial
3+
4+
# %%
5+
from mockup import mockup
6+
7+
# %%
8+
mockup.add_one(-11)
9+
10+
# %%
11+
list(mockup.flatten_ints([[9, 11], [12], [4, 5]]))
12+
13+
# %%
14+
c2 = mockup.Circle.from_circumference(100)
15+
round(c2.radius, 3)
16+
17+
# %%
18+
c2 # repr
19+
20+
# %% [markdown]
21+
#

pyproject.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
authors = [
3-
{name = "Jakob Nybo Nissen", email = "[email protected]"},
4-
{name = "Henry Webel", email = "[email protected]"},
3+
{ name = "Jakob Nybo Nissen", email = "[email protected]" },
4+
{ name = "Henry Webel", email = "[email protected]" },
55
]
66
description = "A small example package"
77
name = "rasmussenlab-mockup"
@@ -29,11 +29,13 @@ docs = [
2929
"myst-nb",
3030
"ipywidgets",
3131
"sphinx-new-tab-link!=0.2.2",
32+
"jupytext",
3233
]
34+
dev = ["black", "ruff", "pytest"]
3335

3436
# Configure the Ruff linter: Ignore error number 501
3537
[tool.ruff]
36-
ignore = ["E501"]
38+
lint.ignore = ["E501"]
3739

3840
[build-system]
3941
build-backend = "setuptools.build_meta"

0 commit comments

Comments
 (0)