Skip to content

Commit

Permalink
Change to py:percent notebooks for docs (#5)
Browse files Browse the repository at this point in the history
* ✨ change to py:percent notebooks

- use "text" based (not json) format notebooks (py:percent)
- done through jupytext

* ✨ add dev dependencies
  • Loading branch information
enryH authored Sep 9, 2024
1 parent 2023030 commit 25751e1
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 97 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,4 @@ jobs:
# remove repository key to set the default to pypi (not test.pypi.org)
repository-url: https://test.pypi.org/legacy/
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
password: ${{ secrets.PYPI_API_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ _build
_static
_templates
/docs/reference
/docs/jupyter_execute

# MacOS automatically creates these files
.DS_Store
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ docs\conf.py:
Install package so that new code is picked up in a restared python interpreter:
```
pip install -e .
pip install -e ".[dev]"
```
## TestPyPI
Expand All @@ -143,4 +143,4 @@ The documentation is build using readthedocs automatically. See
[project on Readthedocs](https://readthedocs.org/projects/rasmussenlab-python-package/).
- make sure to enable build from PRs in the settings (advanded settings)
- checkout configuration file: [`.readthedocs.yaml`](.readthedocs.yaml)
- checkout configuration file: [`.readthedocs.yaml`](.readthedocs.yaml)
11 changes: 10 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,22 @@
# Rendering
nb_merge_streams = True

# https://myst-nb.readthedocs.io/en/latest/authoring/custom-formats.html#write-custom-formats
nb_custom_formats = {".py": ["jupytext.reads", {"fmt": "py:percent"}]}

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
exclude_patterns = [
"_build",
"Thumbs.db",
".DS_Store",
"jupyter_execute",
"conf.py",
]


# Intersphinx options
Expand Down
11 changes: 4 additions & 7 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
.. mockup documentation master file, created by
sphinx-quickstart on Mon Aug 28 14:09:15 2023.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
The mockup package
==================================
==================

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



.. toctree::
:hidden:
:maxdepth: 2
:caption: Tutorial

tutorial/tutorial

.. toctree::
:hidden:
:maxdepth: 2
:caption: Contents:

reference/modules
reference/mockup

.. toctree::
:hidden:
Expand Down
83 changes: 0 additions & 83 deletions docs/tutorial/tutorial.ipynb

This file was deleted.

21 changes: 21 additions & 0 deletions docs/tutorial/tutorial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# %% [markdown]
# # Mockup tutorial

# %%
from mockup import mockup

# %%
mockup.add_one(-11)

# %%
list(mockup.flatten_ints([[9, 11], [12], [4, 5]]))

# %%
c2 = mockup.Circle.from_circumference(100)
round(c2.radius, 3)

# %%
c2 # repr

# %% [markdown]
#
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
authors = [
{name = "Jakob Nybo Nissen", email = "[email protected]"},
{name = "Henry Webel", email = "[email protected]"},
{ name = "Jakob Nybo Nissen", email = "[email protected]" },
{ name = "Henry Webel", email = "[email protected]" },
]
description = "A small example package"
name = "rasmussenlab-mockup"
Expand Down Expand Up @@ -29,11 +29,13 @@ docs = [
"myst-nb",
"ipywidgets",
"sphinx-new-tab-link!=0.2.2",
"jupytext",
]
dev = ["black", "ruff", "pytest"]

# Configure the Ruff linter: Ignore error number 501
[tool.ruff]
ignore = ["E501"]
lint.ignore = ["E501"]

[build-system]
build-backend = "setuptools.build_meta"
Expand Down

0 comments on commit 25751e1

Please sign in to comment.