The following validation tools are used to validate sources (links and xml):
| Name | Type | Default Input | Description |
|---|---|---|---|
| check_links | Python | src |
Checks relative links in Markdown files and warns if the target files doesn't exist. |
| check_schematron | Python | - | Validates XML files against Schematron schemas and reports validation issues. |
| xml_validator | Python | - | Validates XML files or folders against an XSD schema. |
The following tools are used to generate target files from sources:
| Name | Type | Default Input | Default Output | Description |
|---|---|---|---|---|
| expand_docs | Python | src |
site |
Expands Markdown documentation: Includes XML snippets and Markdown tables directly in the Markdown and copies the media folder to the output location. |
| md_builder | Python | src/templates |
site/tables |
Generates Markdown tables from annotated NeTEx XML templates, using XSD schemas for type and cardinality information. |
| schematron_builder | Python | - | - | Generates Schematron files from XML templates with special comment annotations. |
| xml_snippets | Python | src/templates |
site/xml-snippets |
Extracts XML Snippets from templates. |
| pycore | xquery | - | - | Generates Markdown tables from a XSD schema. |
Depending on your installation, a tool may be run in one of these ways:
| Mode | Command |
|---|---|
| Python | python schematron_builder.py |
| uv (file) | uv run python schematron_builder.py |
| uv (module) | uv run python -m schematron_builder |
| Script | schematron-builder |
- Default input folders and/or output folders are used if folders are not explicitly given (not all tools yet).
- The default output folder of the tools is
site, or an according subdirectory ofsite, excluded from git. See also Folders. - Option
-hor--helpprints the usage text.
In general, the NeTEx RG python tools use the argparse library. Thus, you should allways be able to get a usage description by providing the option -h or --help, e.g. with:
uv run md_builder.py --help
The example above requires uv, see How to setup and run the build.
The tool scripts, provide another possibility to run tools from the command line, e.g. by running md-builder.
The script tools/toolchain.py is used to run tools (xml_snippets, md_builder, expand_docs etc.) in sequence in order to generate the site target docs.
The build builds the tools and runs them to create the generated documents in the directory site.
- Install the uv package manager
- Initialize the virtual environment
- Install the build module
- Run the build
Install the uv package manager:
- See uv package manager
- if you have pip installed, you can run
pip install uv
Run the following following commands in the project root directory:
uv venv
source .venv/bin/activate
uv syncCreate the virtual environment directory venv running the following command in the project root directory (needs uv, see Install the uv package manager above):
uv venvIt may respond like this, or similar:
Using CPython 3.14.6
Creating virtual environment at: .venv
Activate with: .venv\Scripts\activate
Run the activation script to activate the virtual environment as proposed in the output above. Then, do the sync to download the project dependencies:
uv syncThis can be skipped as the
buildmodule is now part of the build dependencies.
Make sure you have an up-to-date version of pip and of module build used to run the build:
python -m ensurepip
python -m pip install --upgrade pip buildIf everything is setup correctly, you should be able to the build from your project root directory:
uv run python -m buildIn the PyCharm settings you may configure the Python interpreter with uv based on the .venv directory of the project.
The pyproject.toml is configured to generate scripts for the tools.
These tool scripts are not required for the build, but they may be useful for running tools locally.
The following environment variables shall be set accordingly:
| Environment Variable | Value |
|---|---|
PYTHONPATH |
Add the project root path, where you checked out this repository. |
PATH |
Add the path to the installed scripts to the PATH variable. On Linux, Mac, this may be like ${project-root}/.venv/bin:$PATH, on Windows like ${project-root}\.venv\Scripts |
On Linux or Mac, this can be achieved by adding something like this to your
.zshrcor.bashrcfile:NETEX_RG_HOME=~/path/to/project-root export PYTHONPATH="$NETEX_RG_HOME:$PYTHONPATH" export PATH="$NETEX_RG_HOME/.venv/bin:$PATH"
We work here to create the next NeTEX realisation guide.
When you clone this project, you will get an empty xsd directory. To complete the xsd download run:
git submodule init
git submodule update The scripts can be installed with the following command (executed from the project root):
uv pip install -e .
This generates executable scripts for Linux/Mac and Windows in subdirectories of .venv.
The following tool scripts are available after installation:
- check-links
- check-schematron
- expand-docs
- md-builder
- pycore
- schematron-builder
- xml-validator
- xml-snippets
See also Tools Overview for more information about the tools.
- Add a new entry in the
[project.scripts]section ofpyproject.toml. - If the script requires another package, use
uv addto added to the environment.
The package manager uv simplifies the build and installation of scripts for the tools.
- Dependencies are managed by
uv, as configured inpyproject.tomland more detailed inuv.lock. uvprovides an os-independent interface for scripts- Generated tool scripts run on Windows, Mac or Linux
Components of the build automation:
- pyproject.toml is configured with
setuptools(https://setuptools.pypa.io/en/latest/)- docs can be generated running
python -m build
- docs can be generated running
setup.pyin the root project acts as the interface for the build system- runs
tools.toolchainfromtools/toolchain.pyto generate the docs- here we can add tools to be run during the build.
- runs
- The build writes all output to directory
site, excluded from git
The Github Action pages.yaml runs the script build.sh (can also be tested locally)
- Triggered after commits to main branch (e.g. after the merge of a branch)
- Runs the build via the
python -m buildmechanism - Generates static html pages with Jekyll
- Uploads generated docs to GitHub Pages