structured-tutorials 0.2.0__tar.gz → 0.4.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.2.0 → structured_tutorials-0.4.0}/.github/workflows/tests.yml +7 -1
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/.gitignore +9 -4
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/.readthedocs.yaml +4 -4
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/PKG-INFO +5 -5
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/README.md +3 -3
- structured_tutorials-0.4.0/docs/changelog.rst +65 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/conf.py +6 -2
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/how-tos.rst +11 -6
- structured_tutorials-0.4.0/docs/howto/chdir.rst +104 -0
- structured_tutorials-0.4.0/docs/howto/test-commands.rst +67 -0
- structured_tutorials-0.4.0/docs/howto/vagrant.rst +114 -0
- structured_tutorials-0.4.0/docs/index.rst +30 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/quickstart.rst +9 -48
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/spelling_wordlist.txt +6 -0
- structured_tutorials-0.4.0/docs/tutorials/alternatives/tutorial.yaml +46 -0
- structured_tutorials-0.4.0/docs/tutorials/alternatives-chdir-at-top-level/tutorial.yaml +18 -0
- structured_tutorials-0.4.0/docs/tutorials/chdir/tutorial.yaml +24 -0
- structured_tutorials-0.4.0/docs/tutorials/chdir-false/tutorial.yaml +7 -0
- structured_tutorials-0.4.0/docs/tutorials/chdir-with-mkdtemp/tutorial.yaml +18 -0
- structured_tutorials-0.4.0/docs/tutorials/file/tutorial.yaml +4 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/tutorials/file-copy/tutorial.yaml +1 -1
- structured_tutorials-0.4.0/docs/tutorials/required_executables/tutorial.yaml +18 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/tutorials/skip-part-doc/tutorial.yaml +2 -4
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/tutorials/skip-part-run/tutorial.yaml +3 -6
- structured_tutorials-0.4.0/docs/tutorials/test-output/tutorial.yaml +29 -0
- structured_tutorials-0.4.0/docs/tutorials/vagrant-machines/Vagrantfile +9 -0
- structured_tutorials-0.4.0/docs/tutorials/vagrant-machines/tutorial.yaml +16 -0
- structured_tutorials-0.4.0/docs/tutorials/vagrant-prepare-box/Vagrantfile +11 -0
- structured_tutorials-0.4.0/docs/tutorials/vagrant-prepare-box/box/Vagrantfile +9 -0
- structured_tutorials-0.4.0/docs/tutorials/vagrant-prepare-box/box/provision.sh +15 -0
- structured_tutorials-0.4.0/docs/tutorials/vagrant-prepare-box/tutorial.yaml +21 -0
- structured_tutorials-0.4.0/docs/tutorials/vagrant-simple/Vagrantfile +4 -0
- structured_tutorials-0.4.0/docs/tutorials/vagrant-simple/tutorial.yaml +7 -0
- structured_tutorials-0.4.0/docs/tutorials/vagrant-subdir/subdir/Vagrantfile +4 -0
- structured_tutorials-0.4.0/docs/tutorials/vagrant-subdir/tutorial.yaml +10 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/generate-schema.py +2 -1
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/htmlcov/class_index.html +328 -133
- structured_tutorials-0.4.0/htmlcov/coverage_html_cb_dd2e7eb5.js +735 -0
- structured_tutorials-0.4.0/htmlcov/favicon_32_cb_c827f16f.png +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/htmlcov/function_index.html +672 -267
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/htmlcov/index.html +85 -57
- structured_tutorials-0.4.0/htmlcov/keybd_closed_cb_ce680311.png +0 -0
- structured_tutorials-0.4.0/htmlcov/status.json +1 -0
- structured_tutorials-0.4.0/htmlcov/style_cb_a5a05ca4.css +389 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/htmlcov/z_0ce4b8b40d14c0ec___init___py.html +8 -8
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/htmlcov/z_0ce4b8b40d14c0ec_base_py.html +96 -85
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/htmlcov/z_0ce4b8b40d14c0ec_parts_py.html +216 -191
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/htmlcov/z_0ce4b8b40d14c0ec_tests_py.html +17 -16
- structured_tutorials-0.4.0/htmlcov/z_0ce4b8b40d14c0ec_tutorial_py.html +301 -0
- structured_tutorials-0.4.0/htmlcov/z_0ce4b8b40d14c0ec_types_py.html +112 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/htmlcov/z_0ce4b8b40d14c0ec_validators_py.html +40 -32
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/htmlcov/z_10746939a1c77e4c___init___py.html +11 -11
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/htmlcov/z_10746939a1c77e4c_directives_py.html +8 -8
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/htmlcov/z_10746939a1c77e4c_utils_py.html +280 -225
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/htmlcov/z_1b8c1a89abcc896b___init___py.html +8 -8
- structured_tutorials-0.4.0/htmlcov/z_1b8c1a89abcc896b_base_py.html +616 -0
- structured_tutorials-0.4.0/htmlcov/z_1b8c1a89abcc896b_local_py.html +130 -0
- structured_tutorials-0.4.0/htmlcov/z_1b8c1a89abcc896b_vagrant_py.html +308 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/htmlcov/z_3b10c79445bd681b___init___py.html +8 -8
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/htmlcov/z_3b10c79445bd681b_cli_py.html +114 -93
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/htmlcov/z_3b10c79445bd681b_errors_py.html +32 -24
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/htmlcov/z_3b10c79445bd681b_output_py.html +8 -8
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/htmlcov/z_3b10c79445bd681b_textwrap_py.html +8 -8
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/htmlcov/z_3b10c79445bd681b_typing_py.html +8 -8
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/htmlcov/z_3b10c79445bd681b_utils_py.html +38 -33
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/pyproject.toml +28 -24
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/structured_tutorials/cli.py +30 -9
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/structured_tutorials/errors.py +8 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/structured_tutorials/models/base.py +21 -10
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/structured_tutorials/models/parts.py +39 -14
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/structured_tutorials/models/tests.py +1 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/structured_tutorials/models/tutorial.py +85 -33
- structured_tutorials-0.4.0/structured_tutorials/models/types.py +13 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/structured_tutorials/models/validators.py +8 -0
- structured_tutorials-0.4.0/structured_tutorials/runners/base.py +517 -0
- structured_tutorials-0.4.0/structured_tutorials/runners/local.py +31 -0
- structured_tutorials-0.4.0/structured_tutorials/runners/vagrant.py +209 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/structured_tutorials/sphinx/__init__.py +1 -1
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/structured_tutorials/sphinx/utils.py +70 -15
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/structured_tutorials/utils.py +5 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/conftest.py +24 -3
- structured_tutorials-0.4.0/tests/data/tutorials/Vagrantfile.jinja +5 -0
- structured_tutorials-0.4.0/tests/data/tutorials/alternatives-chdir-false.yaml +14 -0
- structured_tutorials-0.4.0/tests/data/tutorials/alternatives-chdir.yaml +13 -0
- structured_tutorials-0.4.0/tests/data/tutorials/alternatives-configuration.yaml +41 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/data/tutorials/command-as-list.yaml +3 -0
- structured_tutorials-0.4.0/tests/data/tutorials/command-clear-environment-globally.yaml +27 -0
- structured_tutorials-0.4.0/tests/data/tutorials/command-clear-single-environment-variable.yaml +7 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/data/tutorials/command-hide-output.yaml +3 -0
- structured_tutorials-0.4.0/tests/data/tutorials/command-skip-single-command.rst +4 -0
- structured_tutorials-0.4.0/tests/data/tutorials/command-skip-single-command.yaml +7 -0
- structured_tutorials-0.4.0/tests/data/tutorials/command-test-output.yaml +13 -0
- structured_tutorials-0.4.0/tests/data/tutorials/command-with-chdir-template.yaml +8 -0
- structured_tutorials-0.4.0/tests/data/tutorials/command-with-chdir-with-parts.yaml +8 -0
- structured_tutorials-0.4.0/tests/data/tutorials/command-with-chdir.yaml +4 -0
- structured_tutorials-0.4.0/tests/data/tutorials/initial-context.yaml +28 -0
- structured_tutorials-0.4.0/tests/data/tutorials/vagrant-cwd.yaml +33 -0
- structured_tutorials-0.4.0/tests/data/tutorials/vagrant-multi-machine.yaml +23 -0
- structured_tutorials-0.4.0/tests/data/tutorials/vagrant-prepare-box.yaml +13 -0
- structured_tutorials-0.4.0/tests/data/tutorials/vagrant-update-env.yaml +12 -0
- structured_tutorials-0.4.0/tests/data/tutorials/vagrant.yaml +32 -0
- structured_tutorials-0.4.0/tests/models/__init__.py +2 -0
- structured_tutorials-0.4.0/tests/models/test_validators.py +22 -0
- structured_tutorials-0.4.0/tests/runners/__init__.py +0 -0
- structured_tutorials-0.4.0/tests/runners/local/commands/__init__.py +2 -0
- structured_tutorials-0.4.0/tests/runners/local/commands/test_environment.py +84 -0
- structured_tutorials-0.4.0/tests/runners/local/test_alternatives.py +92 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/runners/local/test_command.py +57 -24
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/runners/local/test_local.py +4 -8
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/runners/local/test_prompt.py +2 -1
- structured_tutorials-0.4.0/tests/runners/test_base.py +94 -0
- structured_tutorials-0.4.0/tests/runners/vagrant/__init__.py +2 -0
- structured_tutorials-0.4.0/tests/runners/vagrant/conftest.py +25 -0
- structured_tutorials-0.4.0/tests/runners/vagrant/test_vagrant.py +212 -0
- structured_tutorials-0.4.0/tests/sphinx/__init__.py +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/sphinx/test_wrapper.py +163 -26
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/test_cli.py +28 -7
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/test_models.py +5 -41
- structured_tutorials-0.4.0/uv.lock +1448 -0
- structured_tutorials-0.2.0/docs/changelog.rst +0 -37
- structured_tutorials-0.2.0/docs/index.rst +0 -23
- structured_tutorials-0.2.0/docs/tutorials/alternatives/tutorial.yaml +0 -28
- structured_tutorials-0.2.0/docs/tutorials/file/tutorial.yaml +0 -4
- structured_tutorials-0.2.0/docs/tutorials/test-output/tutorial.yaml +0 -21
- structured_tutorials-0.2.0/htmlcov/status.json +0 -1
- structured_tutorials-0.2.0/htmlcov/z_0ce4b8b40d14c0ec_tutorial_py.html +0 -249
- structured_tutorials-0.2.0/htmlcov/z_1b8c1a89abcc896b_base_py.html +0 -265
- structured_tutorials-0.2.0/htmlcov/z_1b8c1a89abcc896b_local_py.html +0 -352
- structured_tutorials-0.2.0/structured_tutorials/runners/base.py +0 -166
- structured_tutorials-0.2.0/structured_tutorials/runners/local.py +0 -253
- structured_tutorials-0.2.0/tests/data/tutorials/command-test-output.yaml +0 -8
- structured_tutorials-0.2.0/tests/data/tutorials/command-with-chdir.yaml +0 -5
- structured_tutorials-0.2.0/tests/runners/local/test_alternatives.py +0 -49
- structured_tutorials-0.2.0/tests/runners/test_base.py +0 -35
- structured_tutorials-0.2.0/uv.lock +0 -1288
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/.editorconfig +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/.github/workflows/docs.yml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/.github/workflows/mypy.yml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/.github/workflows/quality.yml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/.github/workflows/wheel.yml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/LICENSE +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/Makefile +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/_static/.gitkeep +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/dev.rst +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/include/quickstart-more-features.rst +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/include/quickstart.rst +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/make.bat +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/reference.rst +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/tutorials/cleanup/tutorial.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/tutorials/cleanup-multiple/tutorial.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/tutorials/command-as-list/tutorial.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/tutorials/context/tutorial.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/tutorials/default-context/tutorial.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/tutorials/doc-or-runtime/tutorial.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/tutorials/echo/tutorial.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/tutorials/exit_code/tutorial.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/tutorials/file-full-example/tutorial.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/tutorials/git-export/tutorial.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/tutorials/interactive-prompt/tutorial.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/tutorials/long-commands/tutorial.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/tutorials/prompt/tutorial.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/tutorials/quickstart/tutorial.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/tutorials/templates/tutorial.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/tutorials/temporary-directory/tutorial.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/tutorials/test-command/tutorial.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/docs/tutorials/test-port/tutorial.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/fetch_swagger.sh +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/htmlcov/.gitignore +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/htmlcov/coverage_html_cb_6fb7b396.js +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/htmlcov/coverage_html_cb_bcae5fc4.js +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/htmlcov/favicon_32_cb_58284776.png +0 -0
- /structured_tutorials-0.2.0/htmlcov/keybd_closed_cb_ce680311.png → /structured_tutorials-0.4.0/htmlcov/keybd_closed_cb_900cfef5.png +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/htmlcov/style_cb_6b508a39.css +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/htmlcov/style_cb_8432e98f.css +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/htmlcov/style_cb_8e611ae1.css +0 -0
- /structured_tutorials-0.2.0/htmlcov/style_cb_a5a05ca4.css → /structured_tutorials-0.4.0/htmlcov/style_cb_9ff733b0.css +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/htmlcov/z_10746939a1c77e4c_textwrap_py.html +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/htmlcov/z_3b10c79445bd681b_models_py.html +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/htmlcov/z_3b10c79445bd681b_tutorial_py.html +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/structured_tutorials/__init__.py +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/structured_tutorials/models/__init__.py +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/structured_tutorials/output.py +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/structured_tutorials/runners/__init__.py +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/structured_tutorials/sphinx/directives.py +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/structured_tutorials/templates/alternative_part.rst.template +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/structured_tutorials/templates/commands_part.rst.template +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/structured_tutorials/templates/file_part.rst.template +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/structured_tutorials/textwrap.py +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/structured_tutorials/typing.py +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/__init__.py +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/data/docs/conf.py +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/data/docs/index.rst +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/data/docs/variable_defined_in_config.rst +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/data/tutorials/alternatives-files.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/data/tutorials/alternatives-text.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/data/tutorials/alternatives.yaml +0 -0
- /structured_tutorials-0.2.0/tests/runners/__init__.py → /structured_tutorials-0.4.0/tests/data/tutorials/box/Vagrantfile +0 -0
- /structured_tutorials-0.2.0/tests/sphinx/__init__.py → /structured_tutorials-0.4.0/tests/data/tutorials/box/Vagrantfile.jinja +0 -0
- /structured_tutorials-0.2.0/tests/data/tutorials/command-simple-env.yaml → /structured_tutorials-0.4.0/tests/data/tutorials/command-env-variable-for-single-command.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/data/tutorials/command-simple.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/data/tutorials/command-stdin.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/data/tutorials/command-test-output-count.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/data/tutorials/command-text.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/data/tutorials/command-undefined-variable.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/data/tutorials/file-contents-destination-dir.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/data/tutorials/file-contents-exists.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/data/tutorials/file-contents-text.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/data/tutorials/file-copy-destination-dir.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/data/tutorials/file_contents.txt +0 -0
- /structured_tutorials-0.2.0/tests/data/tutorials/empty.yaml → /structured_tutorials-0.4.0/tests/data/tutorials/invalid-empty.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/data/tutorials/invalid-model.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/data/tutorials/invalid-yaml.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/data/tutorials/multiple-parts.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/data/tutorials/named-part.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/data/tutorials/prompt-confirm-default-false.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/data/tutorials/prompt-confirm-error-template.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/data/tutorials/prompt-confirm.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/data/tutorials/prompt-enter.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/data/tutorials/simple.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/data/tutorials/templates.yaml +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/runners/local/__init__.py +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/runners/local/conftest.py +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/runners/local/test_file.py +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/sphinx/test_app.py +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/sphinx/test_build.py +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/sphinx/test_get_tutorial_path.py +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/test_textwrap.py +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tests/test_utils.py +0 -0
- {structured_tutorials-0.2.0 → structured_tutorials-0.4.0}/tutorials/simple/simple.yaml +0 -0
|
@@ -14,10 +14,16 @@ jobs:
|
|
|
14
14
|
matrix:
|
|
15
15
|
os: [ ubuntu-latest ]
|
|
16
16
|
python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ]
|
|
17
|
-
sphinx-version: [ "8.1", "8.2" ]
|
|
17
|
+
sphinx-version: [ "8.1", "8.2", "9.0", "9.1" ]
|
|
18
18
|
exclude:
|
|
19
19
|
- python-version: "3.10"
|
|
20
20
|
sphinx-version: "8.2"
|
|
21
|
+
- python-version: "3.10"
|
|
22
|
+
sphinx-version: "9.0"
|
|
23
|
+
- python-version: "3.10"
|
|
24
|
+
sphinx-version: "9.1"
|
|
25
|
+
- python-version: "3.11"
|
|
26
|
+
sphinx-version: "9.1"
|
|
21
27
|
|
|
22
28
|
name: Python ${{ matrix.python-version }}, Sphinx ${{ matrix.sphinx-version }}
|
|
23
29
|
steps:
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
*.box
|
|
2
|
+
*.egg-info
|
|
3
3
|
*.py[oc]
|
|
4
|
+
.config/
|
|
5
|
+
.vagrant.d/
|
|
6
|
+
.vagrant/
|
|
7
|
+
/schema.json
|
|
8
|
+
__pycache__/
|
|
4
9
|
build/
|
|
5
10
|
dist/
|
|
6
|
-
wheels/
|
|
7
|
-
*.egg-info
|
|
8
11
|
tests/data/docs/_build/
|
|
12
|
+
tests/data/tutorials/Vagrantfile
|
|
13
|
+
wheels/
|
|
9
14
|
|
|
10
15
|
# Virtual environments
|
|
11
16
|
.venv
|
|
@@ -18,13 +18,13 @@ build:
|
|
|
18
18
|
- git fetch --all --tags || true
|
|
19
19
|
create_environment:
|
|
20
20
|
- asdf plugin add uv
|
|
21
|
-
- asdf install uv 0.9.
|
|
22
|
-
- asdf global uv 0.9.
|
|
21
|
+
- asdf install uv 0.9.27
|
|
22
|
+
- asdf global uv 0.9.27
|
|
23
23
|
install:
|
|
24
|
-
- uv sync
|
|
24
|
+
- uv sync --group dev --group rtd
|
|
25
25
|
pre_build:
|
|
26
26
|
- ./fetch_swagger.sh
|
|
27
|
-
- uv run generate-schema.py
|
|
27
|
+
- uv run generate-schema.py -o > docs/_static/schema.json
|
|
28
28
|
build:
|
|
29
29
|
html:
|
|
30
30
|
- uv run sphinx-build -T -b html docs/ $READTHEDOCS_OUTPUT/html
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: structured-tutorials
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.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/
|
|
@@ -27,7 +27,7 @@ Requires-Dist: jinja2>=3.1.6
|
|
|
27
27
|
Requires-Dist: pydantic>=2.11.4
|
|
28
28
|
Requires-Dist: pyyaml>=6.0.2
|
|
29
29
|
Requires-Dist: sphinx-inline-tabs>=2025
|
|
30
|
-
Requires-Dist: sphinx>=8.
|
|
30
|
+
Requires-Dist: sphinx>=8.1.0; python_version >= '3.11'
|
|
31
31
|
Requires-Dist: sphinx~=8.1.0; python_version < '3.11'
|
|
32
32
|
Requires-Dist: termcolor>=3.2.0
|
|
33
33
|
Requires-Dist: typing-extensions>=4.6.0; python_version < '3.11'
|
|
@@ -44,8 +44,8 @@ Description-Content-Type: text/markdown
|
|
|
44
44
|
`structured-tutorials` allows you to write tutorials that can be rendered as documentation and run on your
|
|
45
45
|
system to verify correctness.
|
|
46
46
|
|
|
47
|
-
With `structured-tutorials` you to specify steps in a
|
|
48
|
-
render
|
|
47
|
+
With `structured-tutorials` you to specify steps (commands, files to create, ...) in a YAML file. A Sphinx
|
|
48
|
+
plugin allows you to render them in your project documentation. A command-line tool can load the YAML file and
|
|
49
49
|
run it on your local system.
|
|
50
50
|
|
|
51
51
|
Please see the [official documentation](https://structured-tutorials.readthedocs.io/) for more detailed
|
|
@@ -68,7 +68,7 @@ extensions = [
|
|
|
68
68
|
]
|
|
69
69
|
|
|
70
70
|
# Optional: Root directory for tutorials (default: location of conf.py)
|
|
71
|
-
#structured_tutorials_root = DOC_ROOT / "tutorials"
|
|
71
|
+
# structured_tutorials_root = DOC_ROOT / "tutorials"
|
|
72
72
|
```
|
|
73
73
|
|
|
74
74
|
## Your first (trivial) tutorial
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
`structured-tutorials` allows you to write tutorials that can be rendered as documentation and run on your
|
|
10
10
|
system to verify correctness.
|
|
11
11
|
|
|
12
|
-
With `structured-tutorials` you to specify steps in a
|
|
13
|
-
render
|
|
12
|
+
With `structured-tutorials` you to specify steps (commands, files to create, ...) in a YAML file. A Sphinx
|
|
13
|
+
plugin allows you to render them in your project documentation. A command-line tool can load the YAML file and
|
|
14
14
|
run it on your local system.
|
|
15
15
|
|
|
16
16
|
Please see the [official documentation](https://structured-tutorials.readthedocs.io/) for more detailed
|
|
@@ -33,7 +33,7 @@ extensions = [
|
|
|
33
33
|
]
|
|
34
34
|
|
|
35
35
|
# Optional: Root directory for tutorials (default: location of conf.py)
|
|
36
|
-
#structured_tutorials_root = DOC_ROOT / "tutorials"
|
|
36
|
+
# structured_tutorials_root = DOC_ROOT / "tutorials"
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
## Your first (trivial) tutorial
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#########
|
|
2
|
+
ChangeLog
|
|
3
|
+
#########
|
|
4
|
+
|
|
5
|
+
******************
|
|
6
|
+
0.4.0 (2026-04-04)
|
|
7
|
+
******************
|
|
8
|
+
|
|
9
|
+
* Added support for running tutorials in Vagrant.
|
|
10
|
+
* Initial context variables are now rendered.
|
|
11
|
+
* Alternatives now allow specific context and environment variables.
|
|
12
|
+
* The JSON schema is now available `here <_static/schema.json>`_ and can be used in IDEs such as PyCharm.
|
|
13
|
+
* Add ability to specify required executables that are checked before running a tutorial.
|
|
14
|
+
* Rename ``tutorial_root`` to ``root``.
|
|
15
|
+
* Alternatives can now be skipped in documentation.
|
|
16
|
+
* Changing the working directory moved out of doc/run blocks as it is common functionality.
|
|
17
|
+
* ``chdir`` can now be ``False`` to switch back to where the tutorial started.
|
|
18
|
+
|
|
19
|
+
******************
|
|
20
|
+
0.3.0 (2025-12-26)
|
|
21
|
+
******************
|
|
22
|
+
|
|
23
|
+
* Add support for Sphinx 9.0.
|
|
24
|
+
* Tutorials can now be configured to pass a clear environment to all processes.
|
|
25
|
+
* Tutorials can now configure additional environment variables passed to all processes.
|
|
26
|
+
* Single commands can now update the environment for all subsequent commands. Values are rendered as
|
|
27
|
+
templates, so you can add (parts of) the output of a command to the environment by combining a test for
|
|
28
|
+
the command output that uses a named pattern in a regular expression for the output.
|
|
29
|
+
* ``parts.{commands}.{command}.run.{chdir}`` is now a template. This allows you to change the directory based
|
|
30
|
+
on the output of a previous command.
|
|
31
|
+
* Bugfix: Individual commands marked as skipped for documentation, are now actually skipped.
|
|
32
|
+
|
|
33
|
+
******************
|
|
34
|
+
0.2.0 (2025-12-23)
|
|
35
|
+
******************
|
|
36
|
+
|
|
37
|
+
Documentation
|
|
38
|
+
=============
|
|
39
|
+
|
|
40
|
+
* Continue reworking the documentation.
|
|
41
|
+
* Add option to render extra text before/after a part. The text is rendered as a template.
|
|
42
|
+
* Parts can now have an ID that you can reference when rendering parts to make sure that you render what
|
|
43
|
+
you actually think you render (useful for longer tutorials).
|
|
44
|
+
* Add ``structured_tutorials_context`` option to pass extra context variables to a tutorial.
|
|
45
|
+
* Rename the ``tutorial_root`` option to ``structured_tutorials_root``.
|
|
46
|
+
* rename the ``structured_tutorial_command_text_width`` option to ``structured_tutorials_command_text_width``.
|
|
47
|
+
|
|
48
|
+
Command-line
|
|
49
|
+
============
|
|
50
|
+
|
|
51
|
+
* Add option ``--define {key} {value}`` to pass extra context variables.
|
|
52
|
+
* Greatly improve error handling.
|
|
53
|
+
* Parts can now have a name that is shown before running a tutorial part.
|
|
54
|
+
* Add option to clear the environment for a command.
|
|
55
|
+
* Add option to add extra environment variables for a command. Environment variables are rendered as
|
|
56
|
+
templates.
|
|
57
|
+
* Add ability to pass input to a process.
|
|
58
|
+
* Command output can now also be tested for line or character count. You can specify an exact match, or a
|
|
59
|
+
minimum and/or maximum.
|
|
60
|
+
|
|
61
|
+
******************
|
|
62
|
+
0.1.0 (2025-12-22)
|
|
63
|
+
******************
|
|
64
|
+
|
|
65
|
+
Initial version.
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"""Standard Sphinx configuration module."""
|
|
2
2
|
|
|
3
|
+
from importlib.util import find_spec
|
|
4
|
+
|
|
3
5
|
# Configuration file for the Sphinx documentation builder.
|
|
4
6
|
#
|
|
5
7
|
# For the full list of built-in configuration values, see the documentation:
|
|
@@ -18,12 +20,14 @@ release = "0.1.0"
|
|
|
18
20
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
|
19
21
|
|
|
20
22
|
extensions = [
|
|
21
|
-
"sphinx_rtd_theme",
|
|
22
23
|
"sphinxcontrib.spelling",
|
|
23
24
|
"structured_tutorials.sphinx",
|
|
24
25
|
"sphinx_inline_tabs",
|
|
25
26
|
]
|
|
26
|
-
|
|
27
|
+
|
|
28
|
+
if find_spec("sphinx_rtd_theme") is not None:
|
|
29
|
+
extensions.append("sphinx_rtd_theme")
|
|
30
|
+
html_theme = "sphinx_rtd_theme"
|
|
27
31
|
|
|
28
32
|
DOC_ROOT = Path(__file__).parent
|
|
29
33
|
structured_tutorials_root = DOC_ROOT / "tutorials"
|
|
@@ -28,15 +28,20 @@ This will render as:
|
|
|
28
28
|
Running commands
|
|
29
29
|
****************
|
|
30
30
|
|
|
31
|
-
Test
|
|
32
|
-
|
|
31
|
+
Test for installed tools
|
|
32
|
+
========================
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
You can specify a list of tools that is required for running the tutorial. ``structured-tutorials`` will then
|
|
35
|
+
test if a certain tool is installed before starting the tutorial and present the user with a nice error
|
|
36
|
+
message:
|
|
36
37
|
|
|
37
|
-
.. literalinclude:: /tutorials/
|
|
38
|
+
.. literalinclude:: /tutorials/required_executables/tutorial.yaml
|
|
38
39
|
:language: yaml
|
|
39
40
|
|
|
41
|
+
.. structured-tutorial:: required_executables/tutorial.yaml
|
|
42
|
+
|
|
43
|
+
.. structured-tutorial-part::
|
|
44
|
+
|
|
40
45
|
Cleanup after running a tutorial
|
|
41
46
|
================================
|
|
42
47
|
|
|
@@ -65,7 +70,7 @@ run, in order, ``clean3``, ``clean1`` and ``clean2``. Should ``cmd1`` return a n
|
|
|
65
70
|
Skip a part at runtime
|
|
66
71
|
======================
|
|
67
72
|
|
|
68
|
-
To skip an entire part at runtime, but still show it in documentation,
|
|
73
|
+
To skip an entire part at runtime, but still show it in documentation, simply set ``run: false``:
|
|
69
74
|
|
|
70
75
|
.. literalinclude:: /tutorials/skip-part-run/tutorial.yaml
|
|
71
76
|
:language: yaml
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
########################
|
|
2
|
+
Change working directory
|
|
3
|
+
########################
|
|
4
|
+
|
|
5
|
+
Sometimes you will want to change the working directory where commands are run from. At runtime, this will
|
|
6
|
+
change the meaning of relatives paths in commands, when rendering documentation, the prompt will show a
|
|
7
|
+
different working directory.
|
|
8
|
+
|
|
9
|
+
The working directory can changed using the ``chdir`` directive of commands. The value is a path, and is
|
|
10
|
+
rendered as a template.
|
|
11
|
+
|
|
12
|
+
*******
|
|
13
|
+
Example
|
|
14
|
+
*******
|
|
15
|
+
|
|
16
|
+
Consider the following tutorial file:
|
|
17
|
+
|
|
18
|
+
.. literalinclude:: /tutorials/chdir/tutorial.yaml
|
|
19
|
+
:language: yaml
|
|
20
|
+
|
|
21
|
+
.. structured-tutorial:: chdir/tutorial.yaml
|
|
22
|
+
|
|
23
|
+
The first commands part shows the user how to switch the working directory and run a command there:
|
|
24
|
+
|
|
25
|
+
.. structured-tutorial-part::
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
The second commands part shows the user how to create and switch to another directory, where the path is
|
|
29
|
+
determined by a context variable:
|
|
30
|
+
|
|
31
|
+
.. structured-tutorial-part::
|
|
32
|
+
|
|
33
|
+
... but will run in a random directory at runtime.
|
|
34
|
+
|
|
35
|
+
``chdir`` and alternatives
|
|
36
|
+
==========================
|
|
37
|
+
|
|
38
|
+
Changing the working directory is a bit more tricky with alternatives. At runtime, it is easy to follow the
|
|
39
|
+
selected alternative and do whatever that alternative specifies. But when rendering documentation, *all*
|
|
40
|
+
alternatives are rendered as tabs. Different alternatives might switch to different directories, so which
|
|
41
|
+
directory should subsequent parts use?
|
|
42
|
+
|
|
43
|
+
That's why a ``chdir`` directive in an alternative part is discarded after the part when rendering
|
|
44
|
+
documentation. If all alternatives switch to the same directory, you can specify ``chdir`` also for the
|
|
45
|
+
alternative. The following contrived example kind of shows how *not* to use this feature, but this better
|
|
46
|
+
showcases how this works:
|
|
47
|
+
|
|
48
|
+
.. literalinclude:: /tutorials/alternatives-chdir-at-top-level/tutorial.yaml
|
|
49
|
+
:language: yaml
|
|
50
|
+
|
|
51
|
+
.. structured-tutorial:: alternatives-chdir-at-top-level/tutorial.yaml
|
|
52
|
+
|
|
53
|
+
The first part renders two alternatives, in this case they even switch to different directories:
|
|
54
|
+
|
|
55
|
+
.. structured-tutorial-part::
|
|
56
|
+
|
|
57
|
+
But since the alternative specifies ``chdir: /alt``, the next part will use that as working directory:
|
|
58
|
+
|
|
59
|
+
.. structured-tutorial-part::
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
Switch back to the original working directory
|
|
63
|
+
=============================================
|
|
64
|
+
|
|
65
|
+
You can also switch back to the original working directory that you started from by setting ``chdir: false``:
|
|
66
|
+
|
|
67
|
+
.. literalinclude:: /tutorials/chdir-false/tutorial.yaml
|
|
68
|
+
:language: yaml
|
|
69
|
+
|
|
70
|
+
.. structured-tutorial:: chdir-false/tutorial.yaml
|
|
71
|
+
|
|
72
|
+
As you can see, the third command is back in the home directory:
|
|
73
|
+
|
|
74
|
+
.. structured-tutorial-part::
|
|
75
|
+
|
|
76
|
+
Use a true temporary directory at runtime
|
|
77
|
+
=========================================
|
|
78
|
+
|
|
79
|
+
Since ``chdir`` is a template value and ``update_context`` and/or output tests (that may update the context)
|
|
80
|
+
are run before applying it, the best way is simply use ``mkdir`` only at runtime:
|
|
81
|
+
|
|
82
|
+
.. literalinclude:: /tutorials/chdir-with-mkdtemp/tutorial.yaml
|
|
83
|
+
:language: yaml
|
|
84
|
+
|
|
85
|
+
.. structured-tutorial:: chdir-with-mkdtemp/tutorial.yaml
|
|
86
|
+
|
|
87
|
+
This will show ``/tmp/docs`` in documentation:
|
|
88
|
+
|
|
89
|
+
.. structured-tutorial-part::
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
Switch to a different directory in documentation and at runtime
|
|
93
|
+
===============================================================
|
|
94
|
+
|
|
95
|
+
The best way to do this is to specify a different context for documentation and runtime. The above example
|
|
96
|
+
already does this.
|
|
97
|
+
|
|
98
|
+
Why do I have to specify ``chdir`` at runtime, even though my command already actually changes it?
|
|
99
|
+
==================================================================================================
|
|
100
|
+
|
|
101
|
+
Because the command you specify is launched in a subprocess, and the caller (structured-tutorials) has no idea
|
|
102
|
+
what that subprocess does. Your command is still useful (it shows that switching directory will work), but
|
|
103
|
+
there is no way to pass this information to the next command.
|
|
104
|
+
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#############
|
|
2
|
+
Test commands
|
|
3
|
+
#############
|
|
4
|
+
|
|
5
|
+
When running commands, there are various ways to test if the command succeeded and ran as expected.
|
|
6
|
+
|
|
7
|
+
You can also use tests to update the context for subsequent commands based on the output of a command.
|
|
8
|
+
|
|
9
|
+
.. NOTE:: You can specify multiple tests as well (e.g. test the output *and* check if a port was opened).
|
|
10
|
+
|
|
11
|
+
********************
|
|
12
|
+
Test the status code
|
|
13
|
+
********************
|
|
14
|
+
|
|
15
|
+
``structured-tutorials`` will abort a tutorial if a specified command does not exit with a status code of
|
|
16
|
+
``0``. To check for a different status code, simply specify ``status_code``:
|
|
17
|
+
|
|
18
|
+
.. literalinclude:: /tutorials/exit_code/tutorial.yaml
|
|
19
|
+
:language: yaml
|
|
20
|
+
|
|
21
|
+
**************************
|
|
22
|
+
Test output of the command
|
|
23
|
+
**************************
|
|
24
|
+
|
|
25
|
+
You can test either the standard output or standard error stream of a command with a regular expression. You
|
|
26
|
+
can also test line and character count. Regular expressions with named patterns can be used to update the
|
|
27
|
+
context for later commands:
|
|
28
|
+
|
|
29
|
+
.. tab:: Configuration
|
|
30
|
+
|
|
31
|
+
.. literalinclude:: /tutorials/test-output/tutorial.yaml
|
|
32
|
+
:caption: docs/tutorials/test-output/tutorial.yaml
|
|
33
|
+
:language: yaml
|
|
34
|
+
|
|
35
|
+
.. tab:: Documentation
|
|
36
|
+
|
|
37
|
+
.. structured-tutorial:: test-output/tutorial.yaml
|
|
38
|
+
|
|
39
|
+
.. structured-tutorial-part::
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
******************
|
|
43
|
+
Run a test command
|
|
44
|
+
******************
|
|
45
|
+
|
|
46
|
+
You can run a test command to verify that the command actually ran successfully:
|
|
47
|
+
|
|
48
|
+
.. literalinclude:: /tutorials/test-command/tutorial.yaml
|
|
49
|
+
:caption: docs/tutorials/test-command/tutorial.yaml
|
|
50
|
+
:language: yaml
|
|
51
|
+
|
|
52
|
+
Note that you can also retry commands, as shown for ports below.
|
|
53
|
+
|
|
54
|
+
*********
|
|
55
|
+
Test port
|
|
56
|
+
*********
|
|
57
|
+
|
|
58
|
+
You can test that a port is opened by the command:
|
|
59
|
+
|
|
60
|
+
.. literalinclude:: /tutorials/test-port/tutorial.yaml
|
|
61
|
+
:caption: docs/tutorials/test-port/tutorial.yaml
|
|
62
|
+
:language: yaml
|
|
63
|
+
|
|
64
|
+
For ports and commands, you can also specify a `retry` to run the test command multiple times before the main
|
|
65
|
+
command is considered to have failed. A `delay` will delay the first run of the command and a
|
|
66
|
+
`backoff_factor` will introduce an increasing delay between retries. A common use case is a daemon that
|
|
67
|
+
will *eventually* open a port, but subsequent commands want to connect to that daemon.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
###########################
|
|
2
|
+
Run a tutorial with Vagrant
|
|
3
|
+
###########################
|
|
4
|
+
|
|
5
|
+
You can use `Vagrant <https://developer.hashicorp.com/vagrant>`_ to run a tutorial inside one (or more)
|
|
6
|
+
virtual machines. This approach is slow and resource intensive, but ensures maximum isolation and allows you
|
|
7
|
+
to write and test tutorials that you would not want to run on the local system.
|
|
8
|
+
|
|
9
|
+
***************
|
|
10
|
+
Getting started
|
|
11
|
+
***************
|
|
12
|
+
|
|
13
|
+
Assuming you have Vagrant installed, getting started is very simple.
|
|
14
|
+
|
|
15
|
+
First, let's write a trivial tutorial file and tell `structured-tutorials` to use the Vagrant runner:
|
|
16
|
+
|
|
17
|
+
.. literalinclude:: /tutorials/vagrant-simple/tutorial.yaml
|
|
18
|
+
:caption: tutorial.yaml
|
|
19
|
+
:language: yaml
|
|
20
|
+
|
|
21
|
+
Then, in same folder as your :file:`tutorial.yaml`, place a simple :file:`Vagrantfile`:
|
|
22
|
+
|
|
23
|
+
.. literalinclude:: /tutorials/vagrant-simple/Vagrantfile
|
|
24
|
+
:caption: Vagrantfile
|
|
25
|
+
|
|
26
|
+
.. structured-tutorial:: vagrant-simple/tutorial.yaml
|
|
27
|
+
|
|
28
|
+
You can now run your tutorial in Vagrant:
|
|
29
|
+
|
|
30
|
+
.. code-block:: console
|
|
31
|
+
|
|
32
|
+
user@host:~$ structured-tutorial tutorial.yaml
|
|
33
|
+
|
|
34
|
+
Configure Vagrant environment
|
|
35
|
+
=================================
|
|
36
|
+
|
|
37
|
+
You can configure `environment variables used by Vagrant <https://developer.hashicorp
|
|
38
|
+
.com/vagrant/docs/other/environmental-variables>`_ invocation by using the `environment` option.
|
|
39
|
+
|
|
40
|
+
The most common example is to configure a different `VAGRANT_CWD <https://developer.hashicorp
|
|
41
|
+
.com/vagrant/docs/other/environmental-variables>`_. The default is the same directory as your tutorial YAML
|
|
42
|
+
file. For example, if you have the Vagrantfile in a subdirectory:
|
|
43
|
+
|
|
44
|
+
.. literalinclude:: /tutorials/vagrant-subdir/tutorial.yaml
|
|
45
|
+
:caption: example/tutorial.yaml
|
|
46
|
+
:language: yaml
|
|
47
|
+
|
|
48
|
+
.. literalinclude:: /tutorials/vagrant-subdir/subdir/Vagrantfile
|
|
49
|
+
:caption: example/subdir/Vagrantfile
|
|
50
|
+
|
|
51
|
+
Use multiple VMs
|
|
52
|
+
================
|
|
53
|
+
|
|
54
|
+
Vagrant allows you to `define multiple VMs in a single Vagrantfile <https://developer.hashicorp
|
|
55
|
+
.com/vagrant/docs/multi-machine>`_. `structured-tutorials` allows you to
|
|
56
|
+
specify in which machine a particular part should run in via the `options` directive:
|
|
57
|
+
|
|
58
|
+
.. literalinclude:: /tutorials/vagrant-machines/tutorial.yaml
|
|
59
|
+
:caption: tutorial.yaml
|
|
60
|
+
:language: yaml
|
|
61
|
+
|
|
62
|
+
In this example the Vagrantfile specifies two VMs:
|
|
63
|
+
|
|
64
|
+
.. literalinclude:: /tutorials/vagrant-machines/Vagrantfile
|
|
65
|
+
:caption: Vagrantfile
|
|
66
|
+
|
|
67
|
+
.. structured-tutorial:: vagrant-machines/tutorial.yaml
|
|
68
|
+
|
|
69
|
+
The first `commands` block will run in the `foo` VM:
|
|
70
|
+
|
|
71
|
+
.. structured-tutorial-part::
|
|
72
|
+
|
|
73
|
+
... while the second block will run in the `bar` VM:
|
|
74
|
+
|
|
75
|
+
.. structured-tutorial-part::
|
|
76
|
+
|
|
77
|
+
Prepare a custom base box
|
|
78
|
+
=========================
|
|
79
|
+
|
|
80
|
+
Sometimes you need to prepare a custom base box for the main tutorial. Known use cases are preparing a box
|
|
81
|
+
that already has some tools installed or changing the VM so that it connects using a different user.
|
|
82
|
+
|
|
83
|
+
The following tutorial is a contrived example showing a user how to set up PostgreSQL on a "db" host and
|
|
84
|
+
Nginx on a "web" host. VMs are started from a custom-built "base" box that already has some common tools
|
|
85
|
+
installed and allows SSH access as root:
|
|
86
|
+
|
|
87
|
+
.. literalinclude:: /tutorials/vagrant-prepare-box/tutorial.yaml
|
|
88
|
+
:caption: tutorial.yaml
|
|
89
|
+
:language: yaml
|
|
90
|
+
|
|
91
|
+
As per the `prepare_box` directive, we have to specify a Vagrantfile for the base box in the ``box/`` folder:
|
|
92
|
+
|
|
93
|
+
.. literalinclude:: /tutorials/vagrant-prepare-box/box/Vagrantfile
|
|
94
|
+
:caption: box/Vagrantfile
|
|
95
|
+
|
|
96
|
+
And the provisioning script in the same location:
|
|
97
|
+
|
|
98
|
+
.. literalinclude:: /tutorials/vagrant-prepare-box/box/provision.sh
|
|
99
|
+
:caption: box/provision.sh
|
|
100
|
+
|
|
101
|
+
And finally the main Vagrantfile specifying the `db` and `web` VMs from the tutorial configuration file:
|
|
102
|
+
|
|
103
|
+
.. literalinclude:: /tutorials/vagrant-prepare-box/Vagrantfile
|
|
104
|
+
:caption: Vagrantfile
|
|
105
|
+
|
|
106
|
+
.. structured-tutorial:: vagrant-prepare-box/tutorial.yaml
|
|
107
|
+
|
|
108
|
+
The first `commands` block will run in the `web` VM:
|
|
109
|
+
|
|
110
|
+
.. structured-tutorial-part::
|
|
111
|
+
|
|
112
|
+
... while the second block will run in the `db` VM:
|
|
113
|
+
|
|
114
|
+
.. structured-tutorial-part::
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
structured-tutorials documentation
|
|
2
|
+
==================================
|
|
3
|
+
|
|
4
|
+
`structured-tutorials` allows you to write tutorials that can be rendered as documentation and run on your
|
|
5
|
+
system to verify correctness.
|
|
6
|
+
|
|
7
|
+
With `structured-tutorials` you to specify steps (commands, files to create, ...) in a YAML file. A Sphinx
|
|
8
|
+
plugin allows you to render them in your project documentation. A command-line tool can load the YAML file and
|
|
9
|
+
run it on your local system.
|
|
10
|
+
|
|
11
|
+
.. toctree::
|
|
12
|
+
:maxdepth: 1
|
|
13
|
+
:caption: Contents:
|
|
14
|
+
|
|
15
|
+
/quickstart
|
|
16
|
+
/how-tos
|
|
17
|
+
/reference
|
|
18
|
+
/changelog
|
|
19
|
+
/dev
|
|
20
|
+
|
|
21
|
+
How-Tos
|
|
22
|
+
-------
|
|
23
|
+
|
|
24
|
+
.. toctree::
|
|
25
|
+
:maxdepth: 1
|
|
26
|
+
:caption: More specific How-Tos:
|
|
27
|
+
|
|
28
|
+
/howto/chdir
|
|
29
|
+
/howto/test-commands
|
|
30
|
+
/howto/vagrant
|
|
@@ -27,6 +27,14 @@ To render your tutorials in Sphinx, add the extension and, optionally, where you
|
|
|
27
27
|
# Location where your tutorials are stored (default: same directory as conf.py).
|
|
28
28
|
#structured_tutorials_root = Path(__file__).parent / "tutorials"
|
|
29
29
|
|
|
30
|
+
Editor integration
|
|
31
|
+
==================
|
|
32
|
+
|
|
33
|
+
The JSON schema is can be found `here <_static/schema.json>`_ and can be used in IDEs for auto-completion
|
|
34
|
+
and validation. For example:
|
|
35
|
+
|
|
36
|
+
* `PyCharm <https://www.jetbrains.com/help/pycharm/yaml.html#json_schema>`_
|
|
37
|
+
|
|
30
38
|
|
|
31
39
|
*******************
|
|
32
40
|
Your first tutorial
|
|
@@ -184,56 +192,9 @@ You can verify the success of commands by checking the status code, the output o
|
|
|
184
192
|
opened properly. You can add multiple tests, and when testing the output, update the context for successive
|
|
185
193
|
commands.
|
|
186
194
|
|
|
187
|
-
|
|
188
|
-
command is considered to have failed. A `delay` will delay the first run of the command and a
|
|
189
|
-
`backoff_factor` will introduce an increasing delay between retries. A common use case is a daemon that
|
|
190
|
-
will *eventually* open a port, but subsequent commands want to connect to that daemon.
|
|
191
|
-
|
|
192
|
-
Test status code
|
|
193
|
-
----------------
|
|
194
|
-
|
|
195
|
-
By default, a non-zero status code is considered an error, but you can also require a non-zero status
|
|
196
|
-
code:
|
|
197
|
-
|
|
198
|
-
.. literalinclude:: /tutorials/exit_code/tutorial.yaml
|
|
199
|
-
:caption: docs/tutorials/exit_code/tutorial.yaml
|
|
200
|
-
:language: yaml
|
|
201
|
-
|
|
202
|
-
Test output
|
|
203
|
-
-----------
|
|
204
|
-
|
|
205
|
-
You can test either the standard output or standard error stream of a command with a regular expression. You
|
|
206
|
-
can also use named patterns to update the context for later commands:
|
|
207
|
-
|
|
208
|
-
.. tab:: Configuration
|
|
209
|
-
|
|
210
|
-
.. literalinclude:: /tutorials/test-output/tutorial.yaml
|
|
211
|
-
:caption: docs/tutorials/test-output/tutorial.yaml
|
|
212
|
-
:language: yaml
|
|
213
|
-
|
|
214
|
-
.. tab:: Documentation
|
|
215
|
-
|
|
216
|
-
.. structured-tutorial:: test-output/tutorial.yaml
|
|
217
|
-
|
|
218
|
-
.. structured-tutorial-part::
|
|
195
|
+
See :doc:`/howto/test-commands` for more information.
|
|
219
196
|
|
|
220
|
-
Run a test command
|
|
221
|
-
------------------
|
|
222
197
|
|
|
223
|
-
You can run a test command to verify that the command actually ran successfully:
|
|
224
|
-
|
|
225
|
-
.. literalinclude:: /tutorials/test-command/tutorial.yaml
|
|
226
|
-
:caption: docs/tutorials/test-command/tutorial.yaml
|
|
227
|
-
:language: yaml
|
|
228
|
-
|
|
229
|
-
Test port
|
|
230
|
-
---------
|
|
231
|
-
|
|
232
|
-
You can test that a port is opened by the command:
|
|
233
|
-
|
|
234
|
-
.. literalinclude:: /tutorials/test-port/tutorial.yaml
|
|
235
|
-
:caption: docs/tutorials/test-port/tutorial.yaml
|
|
236
|
-
:language: yaml
|
|
237
198
|
|
|
238
199
|
Select alternatives
|
|
239
200
|
===================
|