structured-tutorials 0.1.0__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/PKG-INFO +7 -4
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/README.md +6 -3
- structured_tutorials-0.2.0/docs/changelog.rst +37 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/conf.py +1 -1
- structured_tutorials-0.2.0/docs/include/quickstart-more-features.rst +13 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/include/quickstart.rst +0 -2
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/quickstart.rst +56 -44
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/spelling_wordlist.txt +1 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/tutorials/quickstart/tutorial.yaml +3 -1
- structured_tutorials-0.2.0/docs/tutorials/templates/tutorial.yaml +39 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/class_index.html +155 -125
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/function_index.html +197 -122
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/index.html +58 -58
- structured_tutorials-0.2.0/htmlcov/status.json +1 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/z_0ce4b8b40d14c0ec_base_py.html +62 -51
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/z_0ce4b8b40d14c0ec_parts_py.html +195 -192
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/z_0ce4b8b40d14c0ec_tests_py.html +39 -30
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/z_0ce4b8b40d14c0ec_tutorial_py.html +2 -2
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/z_0ce4b8b40d14c0ec_validators_py.html +24 -10
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/z_10746939a1c77e4c___init___py.html +22 -21
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/z_10746939a1c77e4c_directives_py.html +38 -37
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/z_10746939a1c77e4c_utils_py.html +216 -190
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/z_1b8c1a89abcc896b_base_py.html +159 -108
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/z_1b8c1a89abcc896b_local_py.html +127 -128
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/z_3b10c79445bd681b_cli_py.html +44 -35
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/z_3b10c79445bd681b_errors_py.html +24 -20
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/z_3b10c79445bd681b_output_py.html +2 -2
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/z_3b10c79445bd681b_textwrap_py.html +2 -2
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/z_3b10c79445bd681b_typing_py.html +24 -13
- structured_tutorials-0.2.0/htmlcov/z_3b10c79445bd681b_utils_py.html +207 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/structured_tutorials/cli.py +15 -6
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/structured_tutorials/errors.py +4 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/structured_tutorials/models/base.py +11 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/structured_tutorials/models/parts.py +6 -3
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/structured_tutorials/models/tests.py +12 -3
- structured_tutorials-0.2.0/structured_tutorials/models/validators.py +28 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/structured_tutorials/runners/base.py +53 -2
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/structured_tutorials/runners/local.py +18 -19
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/structured_tutorials/sphinx/__init__.py +3 -2
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/structured_tutorials/sphinx/directives.py +4 -3
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/structured_tutorials/sphinx/utils.py +37 -11
- structured_tutorials-0.2.0/structured_tutorials/templates/alternative_part.rst.template +9 -0
- structured_tutorials-0.2.0/structured_tutorials/templates/commands_part.rst.template +9 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/structured_tutorials/templates/file_part.rst.template +6 -1
- structured_tutorials-0.2.0/structured_tutorials/typing.py +26 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/structured_tutorials/utils.py +46 -16
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/data/docs/conf.py +6 -1
- structured_tutorials-0.2.0/tests/data/docs/variable_defined_in_config.rst +3 -0
- structured_tutorials-0.2.0/tests/data/tutorials/alternatives-text.yaml +32 -0
- structured_tutorials-0.2.0/tests/data/tutorials/command-simple-env.yaml +11 -0
- structured_tutorials-0.2.0/tests/data/tutorials/command-test-output-count.yaml +9 -0
- structured_tutorials-0.2.0/tests/data/tutorials/command-text.yaml +10 -0
- structured_tutorials-0.2.0/tests/data/tutorials/command-undefined-variable.yaml +3 -0
- structured_tutorials-0.2.0/tests/data/tutorials/file-contents-exists.yaml +7 -0
- structured_tutorials-0.2.0/tests/data/tutorials/file-contents-text.yaml +10 -0
- structured_tutorials-0.2.0/tests/data/tutorials/prompt-confirm-error-template.yaml +8 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/runners/local/test_command.py +75 -17
- structured_tutorials-0.2.0/tests/runners/local/test_file.py +82 -0
- structured_tutorials-0.2.0/tests/runners/local/test_local.py +89 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/runners/local/test_prompt.py +11 -23
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/sphinx/test_app.py +4 -4
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/sphinx/test_build.py +6 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/sphinx/test_wrapper.py +60 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/test_cli.py +28 -14
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/test_models.py +21 -1
- structured_tutorials-0.2.0/tests/test_utils.py +38 -0
- structured_tutorials-0.1.0/docs/changelog.rst +0 -9
- structured_tutorials-0.1.0/docs/tutorials/simple-file/tutorial.yaml +0 -18
- structured_tutorials-0.1.0/docs/tutorials/templates/tutorial.yaml +0 -19
- structured_tutorials-0.1.0/htmlcov/status.json +0 -1
- structured_tutorials-0.1.0/htmlcov/z_3b10c79445bd681b_utils_py.html +0 -177
- structured_tutorials-0.1.0/structured_tutorials/models/validators.py +0 -14
- structured_tutorials-0.1.0/structured_tutorials/templates/alternative_part.rst.template +0 -5
- structured_tutorials-0.1.0/structured_tutorials/typing.py +0 -15
- structured_tutorials-0.1.0/tests/runners/local/test_local.py +0 -165
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/.editorconfig +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/.github/workflows/docs.yml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/.github/workflows/mypy.yml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/.github/workflows/quality.yml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/.github/workflows/tests.yml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/.github/workflows/wheel.yml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/.gitignore +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/.readthedocs.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/LICENSE +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/Makefile +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/_static/.gitkeep +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/dev.rst +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/how-tos.rst +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/index.rst +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/make.bat +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/reference.rst +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/tutorials/alternatives/tutorial.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/tutorials/cleanup/tutorial.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/tutorials/cleanup-multiple/tutorial.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/tutorials/command-as-list/tutorial.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/tutorials/context/tutorial.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/tutorials/default-context/tutorial.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/tutorials/doc-or-runtime/tutorial.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/tutorials/echo/tutorial.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/tutorials/exit_code/tutorial.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/tutorials/file/tutorial.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/tutorials/file-copy/tutorial.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/tutorials/file-full-example/tutorial.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/tutorials/git-export/tutorial.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/tutorials/interactive-prompt/tutorial.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/tutorials/long-commands/tutorial.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/tutorials/prompt/tutorial.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/tutorials/skip-part-doc/tutorial.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/tutorials/skip-part-run/tutorial.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/tutorials/temporary-directory/tutorial.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/tutorials/test-command/tutorial.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/tutorials/test-output/tutorial.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/docs/tutorials/test-port/tutorial.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/fetch_swagger.sh +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/generate-schema.py +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/.gitignore +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/coverage_html_cb_6fb7b396.js +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/coverage_html_cb_bcae5fc4.js +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/favicon_32_cb_58284776.png +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/keybd_closed_cb_ce680311.png +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/style_cb_6b508a39.css +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/style_cb_8432e98f.css +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/style_cb_8e611ae1.css +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/style_cb_a5a05ca4.css +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/z_0ce4b8b40d14c0ec___init___py.html +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/z_10746939a1c77e4c_textwrap_py.html +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/z_1b8c1a89abcc896b___init___py.html +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/z_3b10c79445bd681b___init___py.html +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/z_3b10c79445bd681b_models_py.html +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/htmlcov/z_3b10c79445bd681b_tutorial_py.html +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/pyproject.toml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/structured_tutorials/__init__.py +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/structured_tutorials/models/__init__.py +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/structured_tutorials/models/tutorial.py +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/structured_tutorials/output.py +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/structured_tutorials/runners/__init__.py +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/structured_tutorials/textwrap.py +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/__init__.py +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/conftest.py +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/data/docs/index.rst +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/data/tutorials/alternatives-files.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/data/tutorials/alternatives.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/data/tutorials/command-as-list.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/data/tutorials/command-hide-output.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/data/tutorials/command-simple.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/data/tutorials/command-stdin.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/data/tutorials/command-test-output.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/data/tutorials/command-with-chdir.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/data/tutorials/empty.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/data/tutorials/file-contents-destination-dir.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/data/tutorials/file-copy-destination-dir.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/data/tutorials/file_contents.txt +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/data/tutorials/invalid-model.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/data/tutorials/invalid-yaml.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/data/tutorials/multiple-parts.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/data/tutorials/named-part.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/data/tutorials/prompt-confirm-default-false.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/data/tutorials/prompt-confirm.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/data/tutorials/prompt-enter.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/data/tutorials/simple.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/data/tutorials/templates.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/runners/__init__.py +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/runners/local/__init__.py +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/runners/local/conftest.py +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/runners/local/test_alternatives.py +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/runners/test_base.py +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/sphinx/__init__.py +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/sphinx/test_get_tutorial_path.py +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tests/test_textwrap.py +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/tutorials/simple/simple.yaml +0 -0
- {structured_tutorials-0.1.0 → structured_tutorials-0.2.0}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: structured-tutorials
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Add your description here
|
|
5
5
|
Project-URL: Homepage, https://structured-tutorials.readthedocs.io/
|
|
6
6
|
Project-URL: Documentation, https://structured-tutorials.readthedocs.io/
|
|
@@ -67,14 +67,14 @@ extensions = [
|
|
|
67
67
|
"structured_tutorials.sphinx",
|
|
68
68
|
]
|
|
69
69
|
|
|
70
|
-
# Optional: Root directory for tutorials
|
|
71
|
-
#
|
|
70
|
+
# Optional: Root directory for tutorials (default: location of conf.py)
|
|
71
|
+
#structured_tutorials_root = DOC_ROOT / "tutorials"
|
|
72
72
|
```
|
|
73
73
|
|
|
74
74
|
## Your first (trivial) tutorial
|
|
75
75
|
|
|
76
76
|
To create your first tutorial, create it in `docs/tutorial.yaml` (or elsewhere, if you configured
|
|
77
|
-
`
|
|
77
|
+
`structured_tutorials_root` in `conf.py`):
|
|
78
78
|
|
|
79
79
|
```yaml
|
|
80
80
|
parts:
|
|
@@ -107,6 +107,9 @@ Configure the tutorial that is being displayed - this will not show any output:
|
|
|
107
107
|
```
|
|
108
108
|
|
|
109
109
|
## TODO
|
|
110
|
+
|
|
111
|
+
* Test file existence or something like that
|
|
112
|
+
* Platform independent "echo" step (useful for debugging/testing)
|
|
110
113
|
* Run in vagrant
|
|
111
114
|
|
|
112
115
|
# License
|
|
@@ -32,14 +32,14 @@ extensions = [
|
|
|
32
32
|
"structured_tutorials.sphinx",
|
|
33
33
|
]
|
|
34
34
|
|
|
35
|
-
# Optional: Root directory for tutorials
|
|
36
|
-
#
|
|
35
|
+
# Optional: Root directory for tutorials (default: location of conf.py)
|
|
36
|
+
#structured_tutorials_root = DOC_ROOT / "tutorials"
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
## Your first (trivial) tutorial
|
|
40
40
|
|
|
41
41
|
To create your first tutorial, create it in `docs/tutorial.yaml` (or elsewhere, if you configured
|
|
42
|
-
`
|
|
42
|
+
`structured_tutorials_root` in `conf.py`):
|
|
43
43
|
|
|
44
44
|
```yaml
|
|
45
45
|
parts:
|
|
@@ -72,6 +72,9 @@ Configure the tutorial that is being displayed - this will not show any output:
|
|
|
72
72
|
```
|
|
73
73
|
|
|
74
74
|
## TODO
|
|
75
|
+
|
|
76
|
+
* Test file existence or something like that
|
|
77
|
+
* Platform independent "echo" step (useful for debugging/testing)
|
|
75
78
|
* Run in vagrant
|
|
76
79
|
|
|
77
80
|
# License
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#########
|
|
2
|
+
ChangeLog
|
|
3
|
+
#########
|
|
4
|
+
|
|
5
|
+
******************
|
|
6
|
+
0.2.0 (2025-12-23)
|
|
7
|
+
******************
|
|
8
|
+
|
|
9
|
+
Documentation
|
|
10
|
+
=============
|
|
11
|
+
|
|
12
|
+
* Continue reworking the documentation.
|
|
13
|
+
* Add option to render extra text before/after a part. The text is rendered as a template.
|
|
14
|
+
* Parts can now have an ID that you can reference when rendering parts to make sure that you render what
|
|
15
|
+
you actually think you render (useful for longer tutorials).
|
|
16
|
+
* Add ``structured_tutorials_context`` option to pass extra context variables to a tutorial.
|
|
17
|
+
* Rename the ``tutorial_root`` option to ``structured_tutorials_root``.
|
|
18
|
+
* rename the ``structured_tutorial_command_text_width`` option to ``structured_tutorials_command_text_width``.
|
|
19
|
+
|
|
20
|
+
Command-line
|
|
21
|
+
============
|
|
22
|
+
|
|
23
|
+
* Add option ``--define {key} {value}`` to pass extra context variables.
|
|
24
|
+
* Greatly improve error handling.
|
|
25
|
+
* Parts can now have a name that is shown before running a tutorial part.
|
|
26
|
+
* Add option to clear the environment for a command.
|
|
27
|
+
* Add option to add extra environment variables for a command. Environment variables are rendered as
|
|
28
|
+
templates.
|
|
29
|
+
* Add ability to pass input to a process.
|
|
30
|
+
* Command output can now also be tested for line or character count. You can specify an exact match, or a
|
|
31
|
+
minimum and/or maximum.
|
|
32
|
+
|
|
33
|
+
******************
|
|
34
|
+
0.1.0 (2025-12-22)
|
|
35
|
+
******************
|
|
36
|
+
|
|
37
|
+
Initial version.
|
|
@@ -26,7 +26,7 @@ extensions = [
|
|
|
26
26
|
html_theme = "sphinx_rtd_theme"
|
|
27
27
|
|
|
28
28
|
DOC_ROOT = Path(__file__).parent
|
|
29
|
-
|
|
29
|
+
structured_tutorials_root = DOC_ROOT / "tutorials"
|
|
30
30
|
|
|
31
31
|
templates_path = ["_templates"]
|
|
32
32
|
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
.. structured-tutorial:: templates/tutorial.yaml
|
|
2
|
+
|
|
3
|
+
First, create a temporary directory:
|
|
4
|
+
|
|
5
|
+
.. structured-tutorial-part:: create-directory
|
|
6
|
+
|
|
7
|
+
Then create a JSON file in it:
|
|
8
|
+
|
|
9
|
+
.. structured-tutorial-part:: create-file
|
|
10
|
+
|
|
11
|
+
You can verify the contents of the file like this:
|
|
12
|
+
|
|
13
|
+
.. structured-tutorial-part::
|
|
@@ -6,10 +6,16 @@ Quickstart
|
|
|
6
6
|
Installation
|
|
7
7
|
************
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
**structured-tutorials** is published on `PyPI <https://pypi.org/project/structured-tutorials/>`_ and
|
|
10
|
+
thus can simply be installed via ``pip`` (or any other package management tool, such as
|
|
11
|
+
`uv <https://docs.astral.sh/uv/>`_):
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
.. code-block:: console
|
|
14
|
+
|
|
15
|
+
$ pip install structured-tutorials
|
|
16
|
+
|
|
17
|
+
To render your tutorials in Sphinx, add the extension and, optionally, where your tutorials are stored
|
|
18
|
+
(this can be outside of the Sphinx root):
|
|
13
19
|
|
|
14
20
|
.. code-block:: python
|
|
15
21
|
|
|
@@ -18,11 +24,8 @@ located:
|
|
|
18
24
|
"structured_tutorials.sphinx",
|
|
19
25
|
]
|
|
20
26
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
# configure the root directory where tutorials are located. Defaults to
|
|
24
|
-
# the Sphinx source directory.
|
|
25
|
-
tutorial_root = DOC_ROOT / "tutorials"
|
|
27
|
+
# Location where your tutorials are stored (default: same directory as conf.py).
|
|
28
|
+
#structured_tutorials_root = Path(__file__).parent / "tutorials"
|
|
26
29
|
|
|
27
30
|
|
|
28
31
|
*******************
|
|
@@ -40,8 +43,12 @@ You can run this tutorial straight away:
|
|
|
40
43
|
.. code-block:: console
|
|
41
44
|
|
|
42
45
|
user@host:~/example/$ structured-tutorial docs/tutorials/quickstart/tutorial.yaml
|
|
46
|
+
Running part 0...
|
|
47
|
+
+ structured-tutorial --help
|
|
43
48
|
usage: structured-tutorial [-h] path
|
|
44
49
|
...
|
|
50
|
+
+ echo "Finished running example tutorial."
|
|
51
|
+
Finished running example tutorial.
|
|
45
52
|
|
|
46
53
|
Finally, you can render the tutorial in your Sphinx tutorial:
|
|
47
54
|
|
|
@@ -54,58 +61,63 @@ In fact, above lines are included below, so this is how this tutorial will rende
|
|
|
54
61
|
.. include:: /include/quickstart.rst
|
|
55
62
|
|
|
56
63
|
***********************
|
|
57
|
-
|
|
64
|
+
A more advanced example
|
|
58
65
|
***********************
|
|
59
66
|
|
|
60
|
-
|
|
61
|
-
templates. This allows you to reduce repetition of values or cases where a tutorial should behave differently
|
|
62
|
-
from runtime when rendering documentation.
|
|
63
|
-
|
|
64
|
-
The following example will create a directory, writes to a file in it and outputs the contents of said file:
|
|
65
|
-
|
|
66
|
-
.. literalinclude:: /tutorials/templates/tutorial.yaml
|
|
67
|
-
:caption: docs/tutorials/templates/tutorial.yaml
|
|
68
|
-
:language: yaml
|
|
69
|
-
|
|
70
|
-
This is how the documentation renders:
|
|
71
|
-
|
|
72
|
-
.. structured-tutorial:: templates/tutorial.yaml
|
|
73
|
-
|
|
74
|
-
.. structured-tutorial-part::
|
|
67
|
+
The above is nice but not very useful. Let's show you a few new cool features next.
|
|
75
68
|
|
|
76
|
-
|
|
69
|
+
Commands, output, file contents and many other parts are rendered using `Jinja templates
|
|
70
|
+
<https://jinja.palletsprojects.com/en/stable/>`_. This allows you to reduce repetition of and use different
|
|
71
|
+
values for documentation and runtime.
|
|
77
72
|
|
|
78
|
-
|
|
73
|
+
Tutorials can create files (that are shown appropriately in your documentation). The tutorial below shows you
|
|
74
|
+
how to create a JSON file that shows up with proper syntax highlighting.
|
|
79
75
|
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
You can test success of a command by checking the status code, output or even if a TCP port was
|
|
77
|
+
opened. When checking the output, you can use regular expressions for matching and even named patterns to
|
|
78
|
+
update the context with runtime data. Below we create a temporary directory with ``mktemp`` and use it
|
|
79
|
+
later to create the file in it.
|
|
82
80
|
|
|
83
|
-
|
|
84
|
-
Tutorials can contain files
|
|
85
|
-
***************************
|
|
81
|
+
The following example will create a directory, writes to a file in it and outputs its contents:
|
|
86
82
|
|
|
87
|
-
|
|
83
|
+
.. literalinclude:: /tutorials/templates/tutorial.yaml
|
|
84
|
+
:caption: docs/tutorials/templates/tutorial.yaml
|
|
85
|
+
:language: yaml
|
|
88
86
|
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
Render this tutorial
|
|
88
|
+
====================
|
|
91
89
|
|
|
92
|
-
|
|
90
|
+
The code in your reStructuredText doesn't look much different. You render three parts, and the first two
|
|
91
|
+
reference the id you have given them in the YAML file.
|
|
93
92
|
|
|
94
|
-
.. literalinclude:: /
|
|
95
|
-
:caption: docs/
|
|
96
|
-
:language:
|
|
93
|
+
.. literalinclude:: /include/quickstart-more-features.rst
|
|
94
|
+
:caption: docs/tutorial.rst
|
|
95
|
+
:language: rst
|
|
97
96
|
|
|
98
|
-
|
|
97
|
+
The above file is included below.
|
|
99
98
|
|
|
100
|
-
..
|
|
99
|
+
.. include:: /include/quickstart-more-features.rst
|
|
101
100
|
|
|
102
|
-
|
|
101
|
+
Run this tutorial
|
|
102
|
+
=================
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
When running this tutorial, it'll do what you instructed the user to do: Create a temporary directory, then a
|
|
105
|
+
JSON file in it, and then output it. Cleanup is assured through the cleanup directive, even if one of the
|
|
106
|
+
commands would fail:
|
|
105
107
|
|
|
106
|
-
|
|
108
|
+
.. code-block:: console
|
|
107
109
|
|
|
108
|
-
|
|
110
|
+
user@host:~/example/$ structured-tutorial docs/tutorials/templates/tutorial.yaml
|
|
111
|
+
Running part create-directory...
|
|
112
|
+
+ mktemp -d
|
|
113
|
+
Running part create-file...
|
|
114
|
+
Running part 2...
|
|
115
|
+
+ cat /tmp/tmp.6G6S9dX0MN/example.txt
|
|
116
|
+
{"key": "run"}
|
|
117
|
+
+ cat /tmp/tmp.6G6S9dX0MN/example.txt | python -m json.tool
|
|
118
|
+
...
|
|
119
|
+
INFO | Running cleanup commands.
|
|
120
|
+
+ rm -r /tmp/tmp.6G6S9dX0M
|
|
109
121
|
|
|
110
122
|
********************************************
|
|
111
123
|
Generating documentation out of the tutorial
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
configuration:
|
|
2
|
+
context: # context shared between documentation and runtime
|
|
3
|
+
filename: example.json
|
|
4
|
+
doc: # template context at runtime
|
|
5
|
+
context:
|
|
6
|
+
dest: /tmp/tmp...
|
|
7
|
+
contents: '{"key": "doc"}'
|
|
8
|
+
run: # template context at runtime
|
|
9
|
+
context:
|
|
10
|
+
# dest is captured and added to the context by mktemp at runtime
|
|
11
|
+
contents: '{"key": "run"}'
|
|
12
|
+
parts:
|
|
13
|
+
- id: create-directory
|
|
14
|
+
commands:
|
|
15
|
+
- command: mktemp -d
|
|
16
|
+
doc:
|
|
17
|
+
output: "{{ dest }}"
|
|
18
|
+
run:
|
|
19
|
+
show_output: false
|
|
20
|
+
test:
|
|
21
|
+
# Capture the whole output and add it to the context
|
|
22
|
+
- regex: (?P<dest>.*)
|
|
23
|
+
cleanup:
|
|
24
|
+
# Remove temporary directory after running the tutorial
|
|
25
|
+
- command: rm -rf {{ dest }}
|
|
26
|
+
- id: create-file
|
|
27
|
+
contents: "{{ contents }}\n"
|
|
28
|
+
destination: "{{ dest }}/{{ filename }}"
|
|
29
|
+
doc:
|
|
30
|
+
language: json
|
|
31
|
+
# If you use sphinxcontrib-spelling, make sure the filename is not spell-checked
|
|
32
|
+
ignore_spelling: true
|
|
33
|
+
- commands:
|
|
34
|
+
- command: cat {{ dest }}/{{ filename }}
|
|
35
|
+
doc:
|
|
36
|
+
output: "{{ contents }}"
|
|
37
|
+
- command: cat {{ dest }}/{{ filename }} | python -m json.tool
|
|
38
|
+
doc:
|
|
39
|
+
output: ...
|