Run the release preflight¶
Run these commands from the repository root with Python 3.11 or newer. The preflight builds the sdist and wheel from a committed Git snapshot, stamps both with the source revision, and runs the packaged tests against an installed wheel. Use a local build directory for the rehearsal.
python -m pip install build twine
mkdir -p build
preflight_dir="$(mktemp -d "$PWD/build/preflight.XXXXXX")"
mkdir -p "$preflight_dir/tree" "$preflight_dir/tmp"
export TMPDIR="$preflight_dir/tmp"
git archive HEAD | tar -x -C "$preflight_dir/tree"
python -c 'import sys; from pathlib import Path; Path(sys.argv[1]).write_text("SOURCE_REVISION = " + repr(sys.argv[2]) + "\n", encoding="utf-8")' \
"$preflight_dir/tree/qdpy/_build_info.py" "$(git rev-parse HEAD)"
python -m build --outdir "$preflight_dir/dist" "$preflight_dir/tree"
python -m twine check --strict "$preflight_dir"/dist/*
python scripts/check_dist.py "$preflight_dir/dist"
tar -xzf "$preflight_dir"/dist/*.tar.gz -C "$preflight_dir"
wheel="$(find "$preflight_dir/dist" -maxdepth 1 -name '*.whl')"
python -m venv "$preflight_dir/wheel-env"
"$preflight_dir/wheel-env/bin/python" -m pip install "${wheel}[test]"
"$preflight_dir/wheel-env/bin/python" -m pip check
(cd "$preflight_dir" && wheel-env/bin/python -I -m pytest qdpy-*/tests)
(cd "$preflight_dir" && wheel-env/bin/python -I qdpy-*/examples/nslc_rastrigin.py \
--seed 42 --outputDir nslc-pip)
To verify the source distribution separately, install it with the docs extra in a fresh environment. Build the Sphinx site using the docs from that archive.
sdist="$(find "$preflight_dir/dist" -maxdepth 1 -name '*.tar.gz')"
uv venv "$preflight_dir/source-env"
uv pip install --python "$preflight_dir/source-env/bin/python" "${sdist}[docs,test]"
uv pip check --python "$preflight_dir/source-env/bin/python"
"$preflight_dir/source-env/bin/python" -I -m sphinx -W -b html \
"$preflight_dir"/qdpy-*/docs "$preflight_dir/html"
(cd "$preflight_dir" && source-env/bin/python -I -m pytest \
qdpy-*/tests/test_result_outputs.py -k map_elites)
(cd "$preflight_dir" && source-env/bin/python -I qdpy-*/examples/nslc_rastrigin.py \
--seed 42 --outputDir nslc-uv)
The replay test checks exact archive bytes, evaluation counts, and the
SHA-256 fingerprint. The wheel suite includes an explicit spawned worker
check and runs all four Run your first searches from PyPI scripts copied into fresh
working directories. On filesystems where process sockets or worker cleanup fail,
use the system temporary directory for the test process and keep pytest
output in the preflight directory. The optional backends job runs
MC-AURORA and the discrete and continuous QD+RL examples with CPU
PyTorch. To check the installed RL extra locally, use a separate
environment with Gymnasium and CPU PyTorch, install the candidate with
[rl,test], and run the RL tests and Quality-Diversity Actor-Critic example.
The default GitLab pipeline retains the distribution and HTML artifacts
for review.
The test-optional-smoke job runs on a dedicated scheduled pipeline.
Once the branch with the job is on GitLab, open Build → Pipeline
schedules, create a weekly schedule against that branch, and add the
schedule variable QDPY_CI_MODE=optional-smoke. Use Run on the
schedule to check it immediately. The scheduled job tests CPU PyTorch
and Gymnasium rollouts, CMA-MAE/NSLC restart, and evaluator-worker
recovery. It retains a JUnit report and a JSON rollout summary. The
full optional-backend suite remains available as a manual job in the
regular pipeline. See the GitLab pipeline schedule guide.
Review QDpy release notes for the candidate changes. Before uploading, verify the release commit on GitLab and confirm version availability on PyPI. Tag the tested commit and upload its universal wheel and source distribution. Users can opt in to acceleration by building a platform wheel from that source distribution.
Build an accelerated wheel¶
Build this wheel in an environment with a C compiler and Python headers. Install Cython in the build environment to opt in to the compiled NSLC and CVT kernels. The resulting wheel uses the existing QDpy API and runtime dependencies. Install it with either package installer. See the Cython build documentation.
With pip:
python -m pip install "setuptools>=77.0.3" "Cython>=3.3.1"
QDPY_BUILD_CYTHON=1 python -m pip wheel --no-build-isolation --no-deps \
--wheel-dir dist/accelerated .
python -m pip install dist/accelerated/qdpy-*.whl
With uv in a .venv environment:
uv pip install "setuptools>=77.0.3" "Cython>=3.3.1"
QDPY_BUILD_CYTHON=1 uv build --wheel --no-build-isolation \
--python .venv/bin/python --out-dir dist/accelerated
uv pip install dist/accelerated/qdpy-*.whl
Check the installed extension with python -I -c "import qdpy._kernels".
The default build produces a universal Python wheel. The accelerated build
produces a wheel for the build interpreter and platform.
To replace a default install of the same version, use
--force-reinstall --no-deps with pip or --reinstall-package qdpy with uv
when installing the accelerated wheel.