Skip to content

Commit 4d20a96

Browse files
committed
Write a first MVP for generating structured tutorials
0 parents  commit 4d20a96

File tree

28 files changed

+1845
-0
lines changed

28 files changed

+1845
-0
lines changed

.github/workflows/docs.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Documentation
2+
on:
3+
push:
4+
pull_request:
5+
6+
env:
7+
UV_PYTHON_PREFERENCE: only-system
8+
UV_NO_SYNC: 1
9+
10+
jobs:
11+
run:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Acquire sources
15+
uses: actions/[email protected]
16+
with:
17+
fetch-depth: 0
18+
- name: Setup Python
19+
uses: actions/[email protected]
20+
with:
21+
python-version: "3.14"
22+
architecture: x64
23+
- name: Install uv
24+
uses: astral-sh/[email protected]
25+
with:
26+
enable-cache: true
27+
- name: Install dependencies
28+
run: uv sync
29+
- name: doc8 style checks
30+
run: uv run doc8 docs/
31+
- name: Generate documentation
32+
run: uv run make -C docs html
33+
- name: Spelling
34+
run: uv run make -C docs spelling

.github/workflows/mypy.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: type checking
2+
on:
3+
push:
4+
pull_request:
5+
6+
env:
7+
UV_PYTHON_PREFERENCE: only-system
8+
UV_NO_SYNC: 1
9+
10+
jobs:
11+
run:
12+
runs-on: ubuntu-latest
13+
steps:
14+
15+
- name: Acquire sources
16+
uses: actions/[email protected]
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Setup Python
21+
uses: actions/[email protected]
22+
with:
23+
python-version: "3.14"
24+
architecture: x64
25+
26+
- name: Install uv
27+
uses: astral-sh/[email protected]
28+
with:
29+
enable-cache: true
30+
31+
- name: Install dependencies
32+
run: uv sync
33+
34+
- name: run mypy
35+
run: uv run mypy .

.github/workflows/quality.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Code quality
2+
on:
3+
push:
4+
pull_request:
5+
6+
env:
7+
UV_PYTHON_PREFERENCE: only-system
8+
UV_NO_SYNC: 1
9+
10+
jobs:
11+
run:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Acquire sources
15+
uses: actions/[email protected]
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Setup Python
20+
uses: actions/[email protected]
21+
with:
22+
python-version: "3.14"
23+
architecture: x64
24+
25+
- name: Install uv
26+
uses: astral-sh/[email protected]
27+
with:
28+
enable-cache: true
29+
30+
- name: Install dependencies
31+
run: uv sync
32+
33+
- name: Ruff format
34+
run: uv run ruff format --diff
35+
36+
- name: Ruff check
37+
run: uv run ruff check

.github/workflows/tests.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Tests
2+
on:
3+
push:
4+
pull_request:
5+
6+
env:
7+
UV_PYTHON_PREFERENCE: only-system
8+
UV_NO_SYNC: 1
9+
10+
jobs:
11+
run:
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ ubuntu-latest ]
16+
python-version: [ "3.11", "3.12", "3.13", "3.14" ]
17+
sphinx-version: [ "7.3", "7.4", "8.1", "8.2" ]
18+
19+
name: Python ${{ matrix.python-version }}, Sphinx ${{ matrix.sphinx-version }}
20+
steps:
21+
22+
- name: Acquire sources
23+
uses: actions/[email protected]
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Setup Python
28+
uses: actions/[email protected]
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
architecture: x64
32+
33+
- name: Install uv
34+
uses: astral-sh/[email protected]
35+
with:
36+
enable-cache: true
37+
38+
- name: Install dependencies
39+
run: uv sync --group Spinx${{ matrix.sphinx-version }}
40+
41+
- name: Run tests
42+
run: uv run pytest -v --cov-report term-missing --durations=20

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Python-generated files
2+
__pycache__/
3+
*.py[oc]
4+
build/
5+
dist/
6+
wheels/
7+
*.egg-info
8+
9+
# Virtual environments
10+
.venv
11+
12+
# Documentation
13+
/docs/_build/
14+
15+
# Coverage
16+
/.coverage
17+
18+
# IntelliJ products (PyCharm)
19+
.idea/

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# structured-tutorials
2+
3+
what we want to do:
4+
5+
* Tutorial as YAML file
6+
* list of commands shown
7+
* config files that are written to a destination
8+
* Alternatives (e.g. Redis vs. RabbitMQ or MariaDB vs. PostgreSQL)
9+
* For both commands and config files
10+
* Execute commands locally
11+
* test output
12+
* test status code
13+
* add cleanup actions
14+
* define tests for successful start
15+
* define waits (e.g. until port is open, ...)
16+
* Render documentation
17+
* Show demo output
18+
* Run locally on command line
19+
* Run in vagrant

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 = .
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) -W -n $(O)

docs/conf.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
"""Standard Sphinx configuration module."""
2+
3+
# Configuration file for the Sphinx documentation builder.
4+
#
5+
# For the full list of built-in configuration values, see the documentation:
6+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
7+
from pathlib import Path
8+
9+
# -- Project information -----------------------------------------------------
10+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
11+
12+
project = "structured-tutorials"
13+
copyright = "2025, Mathias Ertl"
14+
author = "Mathias Ertl"
15+
release = "0.1.0"
16+
17+
# -- General configuration ---------------------------------------------------
18+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
19+
20+
extensions = [
21+
"sphinx_rtd_theme",
22+
"sphinxcontrib.spelling",
23+
"structured_tutorials.sphinx",
24+
]
25+
html_theme = "sphinx_rtd_theme"
26+
27+
DOC_ROOT = Path(__file__).parent
28+
tutorial_root = DOC_ROOT / "tutorials"
29+
30+
templates_path = ["_templates"]
31+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
32+
33+
# Nitpicky mode warns about references wher the target cannot be found.
34+
nitpicky = True
35+
36+
# -- Options for HTML output -------------------------------------------------
37+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
38+
39+
# html_theme = "alabaster"
40+
# html_static_path = ["_static"]

docs/include/quickstart.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Configure the tutorial that is being displayed - this will not show any output:
2+
3+
.. structured-tutorial:: quickstart/quickstart.yaml
4+
5+
Render the first part:
6+
7+
.. structured-tutorial-part::

docs/index.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.. structured-tutorials documentation master file, created by
2+
sphinx-quickstart on Sun May 25 11:37:47 2025.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
structured-tutorials 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: Contents:
17+
18+
/quickstart
19+

0 commit comments

Comments
 (0)