diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index a7909a3..7c66141 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -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 }} \ No newline at end of file + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.gitignore b/.gitignore index fecbf78..84675af 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ _build _static _templates /docs/reference +/docs/jupyter_execute # MacOS automatically creates these files .DS_Store diff --git a/README.md b/README.md index 8f39f58..e222061 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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) \ No newline at end of file +- checkout configuration file: [`.readthedocs.yaml`](.readthedocs.yaml) diff --git a/docs/conf.py b/docs/conf.py index 2bf9101..cad48da 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -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 diff --git a/docs/index.rst b/docs/index.rst index 7fac169..cdf5d7c 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,10 +1,5 @@ -.. 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. @@ -12,16 +7,18 @@ 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: diff --git a/docs/tutorial/tutorial.ipynb b/docs/tutorial/tutorial.ipynb deleted file mode 100644 index 2cb608a..0000000 --- a/docs/tutorial/tutorial.ipynb +++ /dev/null @@ -1,83 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Mockup tutorial" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "from mockup import mockup" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "mockup.add_one(-11)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "list(mockup.flatten_ints([[9, 11], [12], [4, 5]]))" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "c2 = mockup.Circle.from_circumference(100)\n", - "round(c2.radius, 3)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "c2 # repr" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "pathways", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.4" - } - }, - "nbformat": 4, - "nbformat_minor": 2 -} diff --git a/docs/tutorial/tutorial.py b/docs/tutorial/tutorial.py new file mode 100644 index 0000000..2379d13 --- /dev/null +++ b/docs/tutorial/tutorial.py @@ -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] +# diff --git a/pyproject.toml b/pyproject.toml index 7c4bde6..d3ed587 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] authors = [ - {name = "Jakob Nybo Nissen", email = "jakobnybonissen@gmail.com"}, - {name = "Henry Webel", email = "henry.webel@sund.ku.dk"}, + { name = "Jakob Nybo Nissen", email = "jakobnybonissen@gmail.com" }, + { name = "Henry Webel", email = "henry.webel@sund.ku.dk" }, ] description = "A small example package" name = "rasmussenlab-mockup" @@ -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"