Development¶
Setup¶
proWES is packaged with
pyproject.toml;
all dependencies are locked in
uv.lock. You
need uv and Git; uv also
provides the Python version that proWES targets (see requires-python in
pyproject.toml, currently Python 3.13, the version of the base image in the
Dockerfile).
Clone the repository and install the app with its development tools (the
dev extra) from the lock into a virtual environment (.venv):
Install the pre-commit hooks, so that the checks run on every commit, and run them on all files once:
The hooks
(.pre-commit-config.yaml)
format and lint the code with ruff (Google
style docstrings), check types with mypy, check the
project's semgrep (security) and ast-grep (anti-patterns) rules (see Static
analysis rules), lint the GitHub Actions workflows
with actionlint, scan for hardcoded secrets with gitleaks and check that
uv.lock matches pyproject.toml. CI runs the same hooks.
Run the tests:
The version of the package comes from Git tags (vX.Y.Z) via
setuptools-scm; there is no version
to edit in the code.
Run from source¶
To run proWES from the source code, e.g., to debug it or to try changes
without rebuilding the image, start the app and the Celery worker in the dev
environment set up as above. They need MongoDB and RabbitMQ; without the
broker, the app starts and serves the API, but POST /runs fails after it
has forwarded the run to the remote WES, so that the run isn't tracked.
-
Start MongoDB and RabbitMQ, e.g., those of Docker Compose, with their ports published on the host's loopback interface by a
docker-compose.override.yaml(ignored by Git), which Docker Compose merges overdocker-compose.yaml:Or install them locally (MongoDB 7.0 and RabbitMQ 4.3, as in
docker-compose.yaml). RabbitMQ 4.3 then needs the setting thatdocker-compose.yamlgives it, as Celery declares transient non-exclusive queues, which RabbitMQ denies by default: adddeprecated_features.permit.transient_nonexcl_queues = trueto its configuration (e.g., in/etc/rabbitmq/conf.d/90-foca.conf). -
Write a configuration overlay, e.g.,
local/config.yaml(the directorylocal/is ignored by Git), that keeps the runs in the repository instead of/data(relative paths are relative to the working directory): -
Point the app and the worker to the services, with the overlay and the credentials of RabbitMQ (
prowes:prowes, the defaults ofdocker-compose.yaml, or yourRABBITMQ_DEFAULT_USERandRABBITMQ_DEFAULT_PASS, if you set them on the first start; URL-encode other characters than letters, digits,-,.,_and~in the URL), in each shell that runs one of them (see Configuration for these and further variables):export FOCA_CONFIG_OVERLAY=local/config.yaml export MONGO_HOST=localhost export CELERY_BROKER_URL='pyamqp://prowes:prowes@localhost:5672//'With a locally installed RabbitMQ, use its default user
guest, which can connect from the same host only:pyamqp://guest:guest@localhost:5672//. -
From the repository root, start the app with Flask's development server, on the host and port of the config (
server.hostandserver.port,127.0.0.1:8080: the loopback interface only), and the Celery worker in another shell:To serve the app with Gunicorn, as the image does (
pro_wes/gunicorn.py), instead of the development server:
The WES API is then served at http://localhost:8080/ga4gh/wes/v1/, with a
Swagger UI at http://localhost:8080/ga4gh/wes/v1/ui/. For Flask's debugger
and reloader, set server.debug: True in the overlay, only with the loopback
host, as the debugger allows executing arbitrary code. Runs are forwarded to
the WES instances of custom.wes.backends (see WES
instances), none by default; to try runs
without a real WES, use the smoke test instead.
Static analysis rules¶
Besides ruff's security rules (S, from bandit), pre-commit runs
project-specific rules, each with tests:
- semgrep, security rules in
.semgrep/pro-wes.yml, shared with FOCA and the other FOCA apps (keep their patterns, messages and severities identical):flask-debug-enabled: debug mode in the app config or the Helm chartjwt-decode-without-verification: JWTs decoded without verifying the signaturejwt-decode-unsafe-algorithms: JWTs verified with the algorithmnoneor the one the token's header namesyaml-unsafe-load: YAML loaded with PyYAML's full or unsafe loadertls-verification-disabled: certificate verification turned off
- ast-grep, anti-patterns in
.ast-grep/rules/(configured insgconfig.yml); all butpydantic-v1-dict,root-logger-callandstring-status-codecheck the package (pro_wes/) only:foca-config-attribute: untyped access to the FOCA config (app.config.foca)framework-free-tasks: Flask, Werkzeug, Connexion or Starlette imported outside the app, the controllers and the exceptionsgeneric-exception-raised:ExceptionorBaseExceptionraisedhard-coded-url: string literals that start with a URL (not docstrings or other strings that stand alone as a statement); backends and other services come from the configprint-call: output withprint()instead of a loggerpydantic-v1-dict: Pydantic v1's.dict()instead of.model_dump()root-logger-call: messages logged with the root loggerstring-status-code: HTTP status codes returned as strings
pre-commit runs the rule tests when the rules change; run it with uv run
pre-commit ..., as the ast-grep hooks use the ast-grep of the dev
dependencies. To run the rule tests by hand: uv run ast-grep test
--skip-snapshot-tests, and semgrep --test . in .semgrep/ (semgrep is not
a dev dependency: pre-commit installs its own, so install it separately for
this).
Add a rule together with its test cases: for semgrep in
.semgrep/pro-wes.py (Python rules) or .semgrep/pro-wes.test.yaml (YAML
rules), marked with # ruleid: <rule-id> and # ok: <rule-id>; for
ast-grep in .ast-grep/rule-tests/<rule-id>-test.yml, with valid and
invalid snippets. The tests can't check which files a rule applies to
(files and ignores of ast-grep rules, paths of semgrep rules): check
the scoping by hand, e.g., with a finding planted in pro_wes/.
Suppress a finding only if it is a false positive or can't be avoided yet,
with a suppression comment on its line: # nosemgrep: <rule-id>,
# ast-grep-ignore: <rule-id>, # noqa: <code> (ruff),
# type: ignore[<code>] (mypy) or # gitleaks:allow. Give the reason in a
comment on the line before, as most suppression comments can't hold it.
Continuous integration¶
CI
(.github/workflows/ci.yml,
workflow CI) runs on pull requests and on pushes to dev. Its jobs, and
how to run them locally:
| Job | Name | Locally |
|---|---|---|
title |
PR title | Pull request titles follow Conventional Commits, at most 50 characters |
lint |
Lint | uv run pre-commit run --all-files, pipx run --spec cffconvert==2.0.0 cffconvert --validate -i CITATION.cff, uv build |
docs |
Docs | uv run --extra docs mkdocs build --strict (see Documentation) |
test |
Test | uv run coverage run -m pytest && uv run coverage report |
chart |
Chart | helm dependency build deployment, (cd deployment && sha256sum -c charts.sha256), helm lint deployment --strict -f deployment/ci/test-values.yaml (also with -f deployment/ci/optional-values.yaml and with MongoDB auth off; see the job), uv run pytest tests/test_chart.py |
chart-install |
Chart install | tests/chart/install.sh on a kind cluster chart-testing (see Testing the chart) |
smoke |
Smoke test | tests/smoke/check.sh (see Smoke test) |
integration |
Integration | tests/integration/check.sh (see Integration test) |
push |
Push image | Pushes to dev only (and fork dry runs, see below): builds the image and pushes it by digest |
scan |
Scan image | Where nothing is pushed (pull requests, forks): docker build -t prowes:scan ., then Trivy on prowes:scan with .trivyignore.yaml; otherwise the pushed digest |
publish |
Publish image | Pushes to dev only (and fork dry runs), after all other checks passed: attests, signs and tags the scanned digest (dev, sha-<commit>) |
passed |
CI passed | Passes if all other jobs passed or were skipped as intended |
CI passed is the only required check. Add every new job to its needs.
push and publish run on pushes to dev of this repository (and of forks
that set DOCKERHUB_ORG, see below), in the environment dev-images (Docker
Hub secrets, branch dev only); they are skipped on pull requests and in
other forks, which the gate allows. A fork can dry
run them by setting the repository variable DOCKERHUB_ORG to its own
Docker Hub organization (and the secrets DOCKERHUB_LOGIN and
DOCKERHUB_TOKEN, in an environment dev-images): the image is then
published there instead of to elixircloud. DOCKERHUB_ORG is a
repository variable (before: a secret, which the workflow no longer reads).
publish signs and tags only commits that are still the head of dev. See
Verifying images for what the image jobs
publish.
Smoke test¶
The smoke test
(tests/smoke/)
deploys proWES with Docker Compose, as docker-compose.yaml does (app,
Celery worker, MongoDB, RabbitMQ), against a fake WES (fake_wes.py)
instead of a real one. It creates runs, which proWES forwards to the fake
WES, waits until the Celery worker has tracked them to their final state,
and checks the run list, the run logs, the run status, the cancellation of
a run and that the fake WES got the runs as sent. The fake WES is also the
identity provider whose access tokens proWES requires: the test checks that
requests without a valid token are rejected and that users see only their
own runs. It needs Docker Compose, curl and jq. Run it from the repository
root:
It builds the image as prowes:smoke and starts the services in the
Compose project prowes-smoke (set COMPOSE_PROJECT_NAME to change it),
so that the image and data of other local deployments are left alone;
proWES is published on 127.0.0.1:8090, as by docker-compose.yaml, so
stop other deployments that publish that port first. On failure, it shows
the logs of the services. The deployment keeps running after the test, for
inspection, and the test can run again on it; remove it with:
COMPOSE_FILE=docker-compose.yaml:tests/smoke/compose.yaml \
COMPOSE_PROJECT_NAME=prowes-smoke docker compose down --volumes
The fake WES is the one WES instance of the smoke test's config overlay
(custom.wes.backends in tests/smoke/config.yaml), at its service name in
the Compose network (https://fake-wes), with a certificate of its own
certificate authority, which proWES trusts instead of the public ones
(REQUESTS_CA_BUNDLE), so that runs are forwarded with TLS verification on
and no run leaves the Compose network.
Integration test¶
The integration test
(tests/integration/)
runs proWES as the smoke test does, but against
Sapporo, a real WES
implementation (the image of tests/integration/compose.yaml, pinned by
digest and updated by Dependabot), instead of the fake WES, which
stays the identity provider. It creates runs of the CWL workflows of
tests/integration/workflows/, which proWES forwards to Sapporo: one that
completes (its run log, with the engine's output, and the run list), one
that fails (EXECUTOR_ERROR) and one that is canceled while it runs (also
at Sapporo, whose engine container must be gone). It also prints the WES
version of Sapporo's service info (to the job summary in CI). Sapporo runs
cwltool in containers through the host's Docker socket, and access to the
socket amounts to control of the host, so run the test locally only where
that is acceptable. It needs Docker Compose, curl and jq; run it from the
repository root:
export COMPOSE_FILE=docker-compose.yaml:tests/smoke/compose.yaml:tests/integration/compose.yaml
export COMPOSE_PROJECT_NAME=prowes-integration
docker compose up -d --build --wait --wait-timeout 300
tests/integration/check.sh
docker compose down --volumes
The first run pulls the images of Sapporo and cwltool, so the waits are
long (each up to FINAL_WAIT polls, about one a second, by default 300).
As in the smoke test, the image is prowes:smoke and proWES is published
on 127.0.0.1:8090, so stop the smoke test's deployment first. Sapporo
keeps its runs in SAPPORO_RUN_DIR (default .integration/sapporo of the
repository root, ignored by Git), at the same path in its container and on
the host, so that the engine containers it starts find them. The files
belong to root and stay after docker compose down; remove them without
root with a container, from the repository root:
The engine containers join the Compose network, which therefore has the
fixed name prowes-integration (also if COMPOSE_PROJECT_NAME is
changed), and fetch the workflows over HTTP from the service workflows.
The run that is canceled starts its engine container before the cancel,
and the test checks that Sapporo stopped it. On failure, the script cancels
that run and shows the logs of the services; the deployment keeps
running, for inspection, and the test can run again on it.
Where Sapporo 2.4.2 differs from WES 1.1.0, the test accommodates it:
- Sapporo requires the field
workflow_enginein run requests, which WES 1.1.0 makes optional: the test sendsworkflow_engine=cwltool, which proWES forwards. It also checks that Sapporo rejects runs without the field: so each run that Sapporo accepts proves that proWES forwarded it. - Its run logs list the outputs as an array of files, not as an object: proWES leaves them out of the run log, as it does with any invalid field, so the test checks the output file in the engine's standard output (cwltool's output object).
- Its service info reports the WES version
sapporo-wes-2.1.0(Sapporo's extension of WES 1.1.0) intype.versionandsupported_wes_versions, not a version of the WES specification, so it would count as WES 1.0, which can't choose the engine: its entry has the labelwes.version: "1.1"(tests/integration/config.yaml).
WES implementations not covered¶
These WES implementations were checked for the integration test but can't run in it yet, in CI or locally. We don't test interoperability with them for now; they can join the test once the gaps listed here are closed upstream.
metis, checked at commit
676c442
(the head of its dev branch on 21 November 2026), with its API,
PostgreSQL, Valkey and NATS as in its docker-compose.yaml:
- It accepts run requests (
POST /runs) as JSON only. WES 1.1.0 specifiesmultipart/form-data, which proWES sends: metis rejects such requests, and URL-encoded forms, with400(Expected request with Content-Type: application/json). So proWES can't create runs there, and none of the checks of the test (run states, run logs, run lists, cancellation) can run (metis#23). - Its service info has none of the fields of the GA4GH service info (
id,name,type,organization,version), only the WES fields. It reportssupported_wes_versions: ["1.1.0"]but notype.version, so proWES counts it as WES 1.0 (see WES versions): an entry for it needs the labelwes.version: "1.1", as Sapporo's has (metis#24). - It has no releases and publishes no images, and its repository has no
Cargo.lock(Git ignores it). Its Dockerfiles copy the lock file, so its images can't be built from a checkout of a commit, and the versions of its dependencies aren't pinned (metis#25). - It runs Nextflow workflows only (workflow type
NFL, versionDSL2, engineNextflow), so it needs workflows of its own, not the CWL workflows of the test.
Dependencies¶
After changing dependencies in pyproject.toml, update the lock with uv
lock and commit both files.
Dependabot
(.github/dependabot.yml)
opens pull requests labelled type: dependencies once a month, to dev,
grouped per ecosystem: Python dependencies (pyproject.toml and uv.lock),
GitHub Actions, the images of the Dockerfile, the service images of Docker
Compose (MongoDB, RabbitMQ, Flower, and Sapporo of the integration test)
and the pre-commit hook revisions. Some updates are made by hand instead:
- FOCA, in
pyproject.tomlanduv.locktogether with the FOCA base image (the image build fails unless the base image has the locked FOCA); runuv lockafter changingpyproject.toml. - connexion 3, which needs a FOCA upgrade.
- MongoDB minor and major versions (patches still come).
- uv's pin in
.readthedocs.yaml, which must be the version thatuv.locklocks (tests/test_readthedocs.pyfails otherwise).
Documentation¶
This documentation is built with MkDocs and
Material for MkDocs, from
docs/ and
mkdocs.yml,
by Read the Docs (configured in
.readthedocs.yaml)
and in CI (job docs), both with the versions of uv.lock (the docs
extra); warnings, e.g., of broken links, fail the build. The API
reference is generated from the docstrings with
mkdocstrings. To build it locally, or serve
it with live reloading, in the dev environment set up as above, with the
docs dependencies too (uv sync removes the extras that it isn't given, so
dev stays in the command):
uv sync --locked --extra dev --extra docs
uv run mkdocs build --strict # into `site/`, ignored by Git
uv run mkdocs serve
The introduction, the quick start and the citation of the home and getting
started pages are sections of README.md (between --8<-- [start:<name>]
and --8<-- [end:<name>] comments), so that they are written only once.
Links in these sections must be absolute, as they must also work on GitHub
and PyPI.