Skip to content

Commit 662dc7c

Browse files
committed
Added docs
1 parent 8961d99 commit 662dc7c

File tree

13 files changed

+259
-37
lines changed

13 files changed

+259
-37
lines changed

.github/workflows/ci_pipeline.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,24 @@ jobs:
3838
run: |
3939
coverage run -m pytest .
4040
coverage report --sort=cover
41+
build_docs:
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Check out the code
45+
uses: actions/checkout@v3
46+
47+
- name: Install python dependencies
48+
run: |
49+
python -m pip install --upgrade pip
50+
pip install ".[docs]"
51+
52+
- name: Build Sphinx documentation
53+
run: |
54+
cd docs/
55+
make html
56+
57+
- name: Upload built docs as artifact
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: html-docs
61+
path: docs/build/html/

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

docs/source/conf.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# For the full list of built-in configuration values, see the documentation:
4+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
5+
6+
import shutil
7+
import os
8+
9+
def copy_tutorials(app):
10+
src = os.path.abspath("../tutorials")
11+
dst = os.path.abspath("source/tutorials")
12+
13+
# Remove existing target directory if it exists
14+
if os.path.exists(dst):
15+
shutil.rmtree(dst)
16+
17+
shutil.copytree(src, dst)
18+
19+
def setup(app):
20+
app.connect("builder-inited", copy_tutorials)
21+
22+
# -- Project information -----------------------------------------------------
23+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
24+
25+
project = 'maxplotlib'
26+
copyright = '2025, Max Lindqvist'
27+
author = 'Max Lindqvist'
28+
29+
# -- General configuration ---------------------------------------------------
30+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
31+
32+
extensions = [
33+
'nbsphinx',
34+
'sphinx.ext.mathjax',
35+
'sphinx.ext.autodoc',
36+
]
37+
38+
templates_path = ['_templates']
39+
exclude_patterns = []
40+
41+
42+
43+
# -- Options for HTML output -------------------------------------------------
44+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
45+
46+
html_theme = 'sphinx_rtd_theme'
47+
html_static_path = ['_static']

docs/source/index.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.. maxplotlib documentation master file, created by
2+
sphinx-quickstart on Sun Jun 22 11:14:00 2025.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
maxplotlib documentation
7+
========================
8+
9+
Add your content using ``reStructuredText`` syntax. See the
10+
`reStructuredText <https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html>`_
11+
documentation for details.
12+
13+
14+
.. toctree::
15+
:maxdepth: 2
16+
:caption: Tutorials:
17+
18+
tutorials/tutorial_01
19+
tutorials/tutorial_02
20+
tutorials/tutorial_03
21+
tutorials/tutorial_04
22+
tutorials/tutorial_05
23+
tutorials/tutorial_06

pyproject.toml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,23 @@ test = [
2424
"pytest",
2525
"coverage",
2626
]
27+
docs = [
28+
"myst-parser",
29+
"sphinx",
30+
"sphinx-rtd-theme",
31+
"nbsphinx",
32+
"ipykernel",
33+
"nbconvert",
34+
]
2735
dev = [
28-
"maxplotlib[test]",
36+
"maxplotlib[test,docs]",
2937
"ruff",
3038
"black",
3139
"isort",
3240
"jupyterlab",
3341
"nbstripout",
3442
"pre-commit",
43+
"pyproject-fmt",
3544
]
3645
[project.urls]
3746
"Source" = "https://github.com/max-models/maxplotlib"

src/maxplotlib/subfigure/line_plot.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ def add_node(self, x, y, label=None, content="", layer=0, **kwargs):
247247
if layer in self.layers:
248248
self.layers[layer].add(node)
249249
else:
250+
print(f"{self.layers = } {layer = }")
250251
self.layers[layer] = Tikzlayer(layer)
251252
self.layers[layer].add(node)
252253
self._node_counter += 1

tutorials/tutorial_01.ipynb

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "0",
6+
"metadata": {},
7+
"source": [
8+
"\n",
9+
"# Tutorial 1\n"
10+
]
11+
},
312
{
413
"cell_type": "code",
514
"execution_count": null,
6-
"id": "0",
15+
"id": "1",
716
"metadata": {},
817
"outputs": [],
918
"source": [
@@ -16,7 +25,7 @@
1625
{
1726
"cell_type": "code",
1827
"execution_count": null,
19-
"id": "1",
28+
"id": "2",
2029
"metadata": {},
2130
"outputs": [],
2231
"source": [
@@ -33,7 +42,7 @@
3342
{
3443
"cell_type": "code",
3544
"execution_count": null,
36-
"id": "2",
45+
"id": "3",
3746
"metadata": {},
3847
"outputs": [],
3948
"source": [
@@ -53,7 +62,7 @@
5362
{
5463
"cell_type": "code",
5564
"execution_count": null,
56-
"id": "3",
65+
"id": "4",
5766
"metadata": {},
5867
"outputs": [],
5968
"source": [
@@ -72,7 +81,7 @@
7281
],
7382
"metadata": {
7483
"kernelspec": {
75-
"display_name": "Python 3 (ipykernel)",
84+
"display_name": "env_maxplotlib",
7685
"language": "python",
7786
"name": "python3"
7887
},

tutorials/tutorial_02.ipynb

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "0",
6+
"metadata": {},
7+
"source": [
8+
"# Tutorial 2"
9+
]
10+
},
311
{
412
"cell_type": "code",
513
"execution_count": null,
6-
"id": "0",
14+
"id": "1",
715
"metadata": {},
816
"outputs": [],
917
"source": [
@@ -16,7 +24,7 @@
1624
{
1725
"cell_type": "code",
1826
"execution_count": null,
19-
"id": "1",
27+
"id": "2",
2028
"metadata": {},
2129
"outputs": [],
2230
"source": [
@@ -49,7 +57,7 @@
4957
{
5058
"cell_type": "code",
5159
"execution_count": null,
52-
"id": "2",
60+
"id": "3",
5361
"metadata": {},
5462
"outputs": [],
5563
"source": [
@@ -99,7 +107,7 @@
99107
{
100108
"cell_type": "code",
101109
"execution_count": null,
102-
"id": "3",
110+
"id": "4",
103111
"metadata": {},
104112
"outputs": [],
105113
"source": [

tutorials/tutorial_03.ipynb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "0",
6+
"metadata": {},
7+
"source": [
8+
"# Tutorial 3"
9+
]
10+
},
311
{
412
"cell_type": "code",
513
"execution_count": null,
6-
"id": "0",
14+
"id": "1",
715
"metadata": {},
816
"outputs": [],
917
"source": [
@@ -13,7 +21,7 @@
1321
{
1422
"cell_type": "code",
1523
"execution_count": null,
16-
"id": "1",
24+
"id": "2",
1725
"metadata": {},
1826
"outputs": [],
1927
"source": [

0 commit comments

Comments
 (0)