Skip to content

Commit afbda26

Browse files
authored
Fix docs (#24)
* Combine guides and tutorials * rename guides to tutorials * Removed templates * Added examples * Update readme * Formatting of pyproject.toml
1 parent 8523a60 commit afbda26

24 files changed

Lines changed: 1124 additions & 154 deletions

File tree

‎.github/ISSUE_TEMPLATE/bug_report.md‎

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

‎.github/ISSUE_TEMPLATE/feature_request.md‎

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

‎.github/PULL_REQUEST_TEMPLATE.md‎

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

‎.github/workflows/docs.yml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ jobs:
4848
run: |
4949
uv run python docs/tools/notebooks.py execute
5050
uv run python docs/tools/notebooks.py convert --strict
51+
uv run python docs/tools/examples.py
5152
5253
- name: Build the site
5354
working-directory: docs
@@ -59,9 +60,11 @@ jobs:
5960
- name: Smoke test the built site
6061
working-directory: docs
6162
run: |
62-
for page in /index.html /getting-started/installation/index.html /tutorials/example-tutorial/index.html /api/app/index.html /api/app/main/index.html; do
63+
for page in /index.html /getting-started/installation/index.html /tutorials/index.html /tutorials/example-tutorial/index.html /full-examples/index.html /full-examples/sine-wave/index.html /api/app/index.html /api/app/main/index.html; do
6364
test -f "dist$page" || { echo "missing dist$page"; exit 1; }
6465
done
66+
test -f dist/tutorials/example-tutorial/example_tutorial.ipynb
67+
test -f dist/full-examples/sine-wave/plot-1.png
6568
grep -q 'href="/template-python/' dist/index.html || { echo "links do not use the base path"; exit 1; }
6669
echo "all pages built with the /template-python base path"
6770

‎CODE_OF_CONDUCT.md‎

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

‎Makefile‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ NOTEBOOKS = $(PYTHON) docs/tools/notebooks.py
55
DOCS_ENV = DOCS_PYTHON=$(shell $(PYTHON) -c "import sys; print(sys.executable)")
66
FORCE ?=
77

8-
.PHONY: help install test lint readme readme-check docs-install docs-notebooks docs-dev docs-build docs-preview docs-clean
8+
.PHONY: help install test lint readme readme-check docs-install docs-notebooks docs-examples docs-dev docs-build docs-preview docs-clean
99

1010
help: ## list the targets
1111
@grep -E '^[a-zA-Z_-]+:.*?## ' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " %-16s %s\n", $$1, $$2}'
@@ -37,17 +37,23 @@ docs-notebooks: ## execute the changed tutorials and convert all of them (FORCE
3737
$(NOTEBOOKS) execute $(if $(FORCE),--force,)
3838
$(NOTEBOOKS) convert
3939

40+
docs-examples: ## run full Python examples and generate pages with their plots
41+
$(PYTHON) docs/tools/examples.py
42+
4043
docs-dev: ## live preview at http://localhost:4321/template-python/
4144
$(NOTEBOOKS) convert
45+
$(PYTHON) docs/tools/examples.py
4246
cd docs && $(DOCS_ENV) DOCS_VALIDATE_LINKS=false npm run dev
4347

4448
docs-build: ## the static site in docs/dist, as in CI
4549
$(NOTEBOOKS) convert
50+
$(PYTHON) docs/tools/examples.py
4651
cd docs && npm run check:mdx && $(DOCS_ENV) npm run build
4752

4853
docs-preview: ## serve docs/dist
4954
cd docs && npm run preview
5055

5156
docs-clean: ## remove generated pages, assets and build output
5257
$(NOTEBOOKS) clean
58+
rm -rf docs/src/content/docs/full-examples docs/public/full-examples
5359
rm -rf docs/dist docs/.astro

‎README.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,15 @@ Commits](https://www.conventionalcommits.org/); see
8787

8888
The documentation in `docs/` is an Astro + Starlight site: hand-written
8989
pages, the notebooks in `tutorials/` executed and published as pages,
90-
and the API reference generated from the docstrings with
90+
complete Python scripts in `examples/` published with their plots, and
91+
the API reference generated from the docstrings with
9192
[starlight-pydocs](https://ewels.github.io/starlight-pydocs/). It needs
9293
Node 22 or newer.
9394

9495
``` bash
9596
make docs-install # npm packages and the Python docs extra
9697
make docs-notebooks # execute tutorials/*.ipynb and convert them to pages
98+
make docs-examples # run examples/*.py and publish their plots
9799
make docs-dev # live preview at http://localhost:4321/template-python/
98100
make docs-build # the static site in docs/dist
99101
```
@@ -115,4 +117,4 @@ its release date), and add the release notes to `CHANGELOG.md`. The push
115117
to `main` creates a GitHub release with a `vX.Y.Z` tag and publishes the
116118
package to PyPI with trusted publishing (OIDC). The one-time PyPI and
117119
GitHub configuration is described in the [publishing
118-
guide](https://max-models.github.io/template-python/development/publishing/).
120+
tutorial](https://max-models.github.io/template-python/development/publishing/).

‎README.qmd‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,15 @@ Commit messages follow [Conventional Commits](https://www.conventionalcommits.or
8787
## Build docs
8888

8989
The documentation in `docs/` is an Astro + Starlight site: hand-written pages, the notebooks
90-
in `tutorials/` executed and published as pages, and the API reference generated from the
90+
in `tutorials/` executed and published as pages, complete Python scripts in `examples/`
91+
published with their plots, and the API reference generated from the
9192
docstrings with [starlight-pydocs](https://ewels.github.io/starlight-pydocs/). It needs
9293
Node 22 or newer.
9394

9495
```bash
9596
make docs-install # npm packages and the Python docs extra
9697
make docs-notebooks # execute tutorials/*.ipynb and convert them to pages
98+
make docs-examples # run examples/*.py and publish their plots
9799
make docs-dev # live preview at http://localhost:4321/template-python/
98100
make docs-build # the static site in docs/dist
99101
```
@@ -113,4 +115,4 @@ Before merging a release to `main`, update the version in `pyproject.toml`,
113115
notes to `CHANGELOG.md`. The push to `main` creates a GitHub release with a `vX.Y.Z` tag and
114116
publishes the package to PyPI with trusted publishing (OIDC). The one-time PyPI and GitHub
115117
configuration is described in the
116-
[publishing guide](https://max-models.github.io/template-python/development/publishing/).
118+
[publishing tutorial](https://max-models.github.io/template-python/development/publishing/).

‎docs/.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ node_modules/
66
.cache/
77
public/tutorials/
88
src/content/docs/tutorials/*.mdx
9+
public/full-examples/
10+
src/content/docs/full-examples/

‎docs/astro.config.mjs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ export default defineConfig({
7373
label: 'Tutorials',
7474
items: [{ autogenerate: { directory: 'tutorials' } }],
7575
},
76+
{
77+
label: 'Full examples',
78+
items: [{ autogenerate: { directory: 'full-examples' } }],
79+
},
7680
{
7781
label: 'Development',
7882
items: [

0 commit comments

Comments
 (0)