Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
d24b605
Python: remove dead Py2 __future__ import from colors.py
gusthoff Jun 12, 2026
9d813c5
Merge feat/remove-py2-future: drop inert Py2 compatibility import
gusthoff Jun 12, 2026
3ef0b56
Python: convert library modules to explicit relative imports
gusthoff Jun 12, 2026
5dedc13
Python: convert CLI modules to explicit relative imports
gusthoff Jun 12, 2026
6035947
Test script: invoke code_projects CLIs via python -m in compile_blocks
gusthoff Jun 12, 2026
c03b652
Merge feat/explicit-imports: make intra-package imports explicit
gusthoff Jun 12, 2026
7d466e2
Python: add rst_code_example_pipeline project and move code_projects …
gusthoff Jun 12, 2026
da5f073
Python: add cli/ subpackage with console-script main() wrappers
gusthoff Jun 12, 2026
ee3a02a
Vagrant: install rst_code_example_pipeline editable in both VMs
gusthoff Jun 12, 2026
7bd5114
Makefile: drop py_modules from PYTHONPATH (editable install replaces it)
gusthoff Jun 12, 2026
11f8827
Test script: use entry points and rst_code_example_pipeline in compil…
gusthoff Jun 12, 2026
0dbf100
CI: point type-check workflow at frontend/python/rst_code_example_pip…
gusthoff Jun 12, 2026
e2a2e8c
Python: use setuptools.build_meta backend (compatible with older setu…
gusthoff Jun 12, 2026
2ef5c41
Merge feat/package-move-and-install: real importable installed package
gusthoff Jun 12, 2026
8b28a45
Test script: add import and entry-point smoke tests for the package
gusthoff Jun 12, 2026
a0d8375
Merge feat/package-smoke-tests: add package smoke tests
gusthoff Jun 12, 2026
da77b9a
Python: move chop + resource into rst_code_example_pipeline (git mv)
gusthoff Jun 12, 2026
745f88b
Sphinx: import chop/resource from rst_code_example_pipeline in widget
gusthoff Jun 12, 2026
376bd34
Test script: update execute_rst_code_blocks chop import
gusthoff Jun 12, 2026
83e706e
Sphinx: update widget chop/resource tests to new import path
gusthoff Jun 12, 2026
2db0674
Test: drop widget.chop import guard from smoke tests (chop now in pac…
gusthoff Jun 12, 2026
49833d6
Merge feat/move-chop-resource: invert widget→pipeline dependency
gusthoff Jun 13, 2026
ef4e101
Python: move toolchain.ini into data/ subdirectory (git mv)
gusthoff Jun 13, 2026
7ca089f
Python: load toolchain.ini via importlib.resources; declare as packag…
gusthoff Jun 13, 2026
324596e
Vagrant: update toolchain.ini path after data/ subdirectory move
gusthoff Jun 13, 2026
a9e00c0
CI: update toolchain.ini path in install_toolchain.sh
gusthoff Jun 13, 2026
1450e02
Python: remove pyrightconfig.json (superseded by pyproject.toml)
gusthoff Jun 13, 2026
8eab0c3
Docs: refresh package README with entry-point commands
gusthoff Jun 13, 2026
fa8a9b1
Docs: add python/README.md index for Python packages
gusthoff Jun 13, 2026
4d1aa10
Merge feat/relocate-config-docs: move toolchain.ini into data/ subdir
gusthoff Jun 13, 2026
187f307
CI: install package before running pyright type check
gusthoff Jun 13, 2026
aa9bb56
Merge feat/ci-type-check: install package before pyright run
gusthoff Jun 13, 2026
985f56d
Docs: update root README and CONTRIBUTING for renamed package
gusthoff Jun 13, 2026
32a14b6
Merge feat/docs-refresh: update root docs for renamed package
gusthoff Jun 13, 2026
6328225
Python: drop prefix from entry-point command names
gusthoff Jun 13, 2026
f94e21e
Editorial: align line escapes
gusthoff Jun 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/code-projects-type-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ name: code_projects Type Check
on:
push:
paths:
- 'frontend/py_modules/code_projects/**'
- 'frontend/python/rst_code_example_pipeline/**'
pull_request:
branches:
- main
paths:
- 'frontend/py_modules/code_projects/**'
- 'frontend/python/rst_code_example_pipeline/**'

jobs:
pyright:
Expand All @@ -27,6 +27,8 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install pyright
run: pip install pyright
- name: Run pyright on code_projects
working-directory: frontend/py_modules/code_projects
- name: Install rst_code_example_pipeline
run: pip install -e frontend/python/rst_code_example_pipeline
- name: Run pyright on rst_code_example_pipeline
working-directory: frontend/python/rst_code_example_pipeline
run: pyright .
2 changes: 1 addition & 1 deletion .github/workflows/install_toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

GNAT_FSF_BUILDS=https://github.com/alire-project/GNAT-FSF-builds/releases/download

TOOLCHAIN_CONFIG=${GITHUB_WORKSPACE}/frontend/py_modules/code_projects/toolchain.ini
TOOLCHAIN_CONFIG=${GITHUB_WORKSPACE}/frontend/python/rst_code_example_pipeline/src/rst_code_example_pipeline/data/toolchain.ini

INSTALL_GNATPROVE=NO
INSTALL_GNAT=NO
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ By default, the standard version of the GNAT toolchain specified in the
frontend is used in the testing phase. The list of versions for each specific
tool from the GNAT toolchain can be found in this file:

frontend/py_modules/code_projects/toolchain.ini
frontend/python/rst_code_example_pipeline/src/rst_code_example_pipeline/data/toolchain.ini

An alternative version of a tool can be selected for a specific code block
using the `gnat=`, `gnatprove=` or `gprbuild=` parameters. For example:
Expand Down
26 changes: 11 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,11 @@ website being served from the local Python-based HTTP server.
The ReST files found in the [content directory](content) have `.. code:: ada`
blocks that contain source-code examples. To test the expected behavior of
those examples, a test script called `compile_blocks.py` is available, as well
as the `code_projects` module.
as the `rst_code_example_pipeline` package.

To make use of this test infrastructure, the best approach is to start the
Vagrant publishing server (`epub`) and install the environment:

```sh
cd /vagrant/frontend
export PYTHONPATH="$PYTHONPATH:sphinx:py_modules"
```
Vagrant publishing server (`epub`). The Python environment is configured
automatically during provisioning.


### Using the `compile_blocks.py` script
Expand Down Expand Up @@ -203,28 +199,28 @@ python3 tests/compile_blocks.py \
```


### Using the code_projects module
### Using the rst_code_example_pipeline package

The [code_projects module](frontend/py_modules/code_projects) contains the
The [rst_code_example_pipeline package](frontend/python/rst_code_example_pipeline) contains the
actual Python modules that are called by the `compile_blocks.py` script. It's
possible to use them directly:
possible to use them directly via the installed entry points:

- `extract_projects.py` extracts all code blocks and stores into the specified
- `extract-code` extracts all code blocks and stores into the specified
directory;

- `check_projects.py` checks each code blocks from the specified directory.
- `check-code` checks each code block from the specified directory.

For example, to build the source-code examples from the
[Introduction to Ada course](content/courses/intro-to-ada), run:

```sh
python3 py_modules/code_projects/extract_projects.py \
extract-code \
--build-dir test_output \
$(find ../content/courses/intro-to-ada/ -name '*.rst')

python3 py_modules/code_projects/check_projects.py \
check-code \
--build-dir test_output
```

For more examples and alternative configurations, please refer to the
[README of the code_projects module](frontend/py_modules/code_projects/README.md)
[README of the rst_code_example_pipeline package](frontend/python/rst_code_example_pipeline/README.md)
6 changes: 4 additions & 2 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ $frontend = <<-SHELL
python3 -m venv /vagrant/venv
source /vagrant/venv/bin/activate
pip3 install -r /vagrant/frontend/requirements_frozen.txt
pip3 install -e /vagrant/frontend/python/rst_code_example_pipeline

# File system: increase number of user watches
# Needed for npm
Expand Down Expand Up @@ -205,6 +206,7 @@ $epub = <<-SHELL
python3 -m venv /vagrant/venv
source /vagrant/venv/bin/activate
pip3 install -r /vagrant/frontend/requirements_frozen.txt
pip3 install -e /vagrant/frontend/python/rst_code_example_pipeline

# File system: increase number of user watches
# Needed for npm
Expand Down Expand Up @@ -232,7 +234,7 @@ Vagrant.configure("2") do |config|
web.vm.synced_folder './frontend', '/vagrant/frontend'
web.vm.synced_folder './content', '/vagrant/content'

web.vm.provision "file", source: "./frontend/py_modules/code_projects/toolchain.ini", destination: "/home/vagrant/toolchain.ini"
web.vm.provision "file", source: "./frontend/python/rst_code_example_pipeline/src/rst_code_example_pipeline/data/toolchain.ini", destination: "/home/vagrant/toolchain.ini"
web.vm.provision "file", source: "./frontend/vm_apt_web.txt", destination: "/home/vagrant/vm_apt.txt"
web.vm.provision :shell, inline: $frontend
end
Expand All @@ -244,7 +246,7 @@ Vagrant.configure("2") do |config|
epub.vm.synced_folder './frontend', '/vagrant/frontend'
epub.vm.synced_folder './content', '/vagrant/content'

epub.vm.provision "file", source: "./frontend/py_modules/code_projects/toolchain.ini", destination: "/home/vagrant/toolchain.ini"
epub.vm.provision "file", source: "./frontend/python/rst_code_example_pipeline/src/rst_code_example_pipeline/data/toolchain.ini", destination: "/home/vagrant/toolchain.ini"
epub.vm.provision "file", source: "./frontend/vm_apt_epub.txt", destination: "/home/vagrant/vm_apt.txt"
epub.vm.provision :shell, inline: $epub
end
Expand Down
4 changes: 2 additions & 2 deletions frontend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ SPHINXCONF = sphinx
BUILDDIR = dist
SRC_TEST_DIR = $(BUILDDIR)/test_output
TEST_LAMBDA ?= 0
TEST_LOCAL_DRIVER = PYTHONPATH="$PYTHONPATH:sphinx:py_modules" python3 tests/compile_blocks.py --keep_files -B $(SRC_TEST_DIR)
TEST_LOCAL_DRIVER = PYTHONPATH="$PYTHONPATH:sphinx" python3 tests/compile_blocks.py --keep_files -B $(SRC_TEST_DIR)
TEST_OPTIONS ?=
TEST_LAMBDA_DRIVER = PYTHONPATH="$PYTHONPATH:sphinx:py_modules" python3 tests/execute_rst_code_blocks.py --halt-on-failure
TEST_LAMBDA_DRIVER = PYTHONPATH="$PYTHONPATH:sphinx" python3 tests/execute_rst_code_blocks.py --halt-on-failure

ifeq ($(strip $(TEST_LAMBDA)),1)
TEST_DRIVER := $(TEST_LAMBDA_DRIVER)
Expand Down
169 changes: 0 additions & 169 deletions frontend/py_modules/code_projects/README.md

This file was deleted.

2 changes: 0 additions & 2 deletions frontend/py_modules/code_projects/__init__.py

This file was deleted.

6 changes: 0 additions & 6 deletions frontend/py_modules/code_projects/pyrightconfig.json

This file was deleted.

7 changes: 7 additions & 0 deletions frontend/python/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Python packages

This directory contains Python packages used by the learn infrastructure.

| Package | Description |
|---------|-------------|
| [rst_code_example_pipeline](rst_code_example_pipeline/) | Extract, build, and check RST code blocks |
Loading
Loading