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 (Sapporo), Integration (WESkit), Integration (Conquest) | tests/integration/check.sh, tests/integration/weskit/check.sh, tests/integration/conquest/setup.sh and 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 tests run proWES as the smoke test does, but against real
WES implementations, one per test (and per entry of the CI job): Sapporo,
WESkit and Conquest. The test against Sapporo
(tests/integration/)
runs proWES 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).
WESkit¶
The integration test against
WESkit
(tests/integration/weskit/,
job Integration (WESkit)) runs the same way, with a Compose override,
config overlay and script of its own; the scripts share their functions
(tests/integration/lib.sh). It creates runs of the workflows of
tests/integration/weskit/workflows/, for each workflow type that WESkit
runs (Snakemake and Nextflow, each workflow in both languages): one that
completes (its run log, its output file at WESkit with the run's
parameter, and the run list), one that fails (EXECUTOR_ERROR), and one
that WESkit can't cancel (see below). Run it from the repository root:
export COMPOSE_FILE=docker-compose.yaml:tests/smoke/compose.yaml:tests/integration/weskit/compose.yaml
export COMPOSE_PROJECT_NAME=prowes-integration-weskit
docker compose up -d --build --wait --wait-timeout 600
tests/integration/weskit/check.sh
docker compose down --volumes
WESkit publishes no images of its releases (its registry has images of
2023 and older), so Compose builds WESkit 1.0.0 from the commit of its tag
v1.0.0 (a95ec25), on WESkit's base image, pinned by digest, which holds
its Conda environment with Snakemake 9.16.3 and Nextflow 25.04.3 (whose
framework the image holds, so it runs offline); WESkit's own CI builds its
image the same way. Dependabot updates neither: to move to another
WESkit release, set the commit of its tag in the build context of
tests/integration/weskit/compose.yaml, and the digest of the base image
that WESkit's CI uses for it
(registry.gitlab.com/one-touch-pipeline/weskit/api/base, tag master).
The first build pulls the base image (about 1 GB). WESkit's REST API
(uWSGI) and its Celery worker use proWES's MongoDB (database WES) and a
Redis of their own; the worker runs Snakemake in its own container
(executor: local), so no container is started through the Docker socket.
WESkit's configuration (tests/integration/weskit/weskit.yaml) follows
the example of WESkit's Compose deployment, without login.
Where WESkit 1.0.0 differs from WES 1.1.0, the test accommodates it:
- It cancels no runs:
POST /runs/{run_id}/cancelfails with500(NotImplementedErrorin WESkit'sManager.cancel()). The test checks that proWES passes the error on (500, "The remote WES service answered with an error.") and that the run goes on, at WESkit and in proWES, until it completes. - It takes only relative workflow URLs (of its directory of installed
workflows,
WESKIT_WORKFLOWS, or of attachments) andtrs://URIs;https://URLs are refused. The test's workflows are installed in that directory, and the runs name them relative to it (e.g.,hello/Snakefile). - It runs Snakemake and Nextflow workflows (
SMK,NFL) only, and takes the version of the engine as the version of the workflow type (SMK9.16.3,NFL25.04.3), which proWES must accept too: the config overlay adds them to proWES'sworkflow_type_versions. - Its run logs list the outputs as
{"filesystem": [<paths>]}, not as an object of output names, andstdoutandstderras paths in the run directory, not as URLs; the test checks the output file in WESkit's run log. - Its service info reports the WES version that its configuration sets
(
static_service_info):1.1.0here, so proWES routes runs to it as a WES 1.1 instance without the labelwes.version.
Conquest¶
The integration test against
Conquest
(tests/integration/conquest/,
job Integration (Conquest)) runs Conquest on a kind cluster, as Conquest
runs only on Kubernetes: its runner and the jobs of the workflows (tasks of
its own TES) are Pods there. setup.sh applies cluster.yaml (namespace
conquest, PostgreSQL, an S3 server, versitygw, and their Secrets, with
fixed test credentials) and installs Conquest's chart from the commit of
its master branch that setup.sh names (Conquest publishes no chart and
no releases), with the images of that commit, pinned by digest
(values.yaml). Conquest's API is served at a node port of the cluster's
node; proWES, its worker and the fake WES join kind's Docker network
(kind) to reach it. For each of the workflow types Snakemake (SMK,
the Snakefiles of the WESkit test) and WDL (the workflows of
tests/integration/conquest/workflows/), the test creates a run that
completes (its run log, its task at Conquest, the run list and, for WDL,
its output file), one that fails (EXECUTOR_ERROR), and one that is
canceled while it runs (also at Conquest, whose runner and task Pods must
be gone). Run it from the repository root, with kind, kubectl and helm,
and a kubeconfig of its own outside the repository (so that the cluster's
credentials can't be committed):
export KUBECONFIG="${TMPDIR:-/tmp}/prowes-conquest.kubeconfig"
kind create cluster --name prowes-conquest
tests/integration/conquest/setup.sh
export COMPOSE_FILE=docker-compose.yaml:tests/smoke/compose.yaml:tests/integration/conquest/compose.yaml
export COMPOSE_PROJECT_NAME=prowes-integration-conquest
docker compose up -d --build --wait --wait-timeout 300
tests/integration/conquest/check.sh
docker compose down --volumes
kind delete cluster --name prowes-conquest
Both scripts refuse to run unless the current context is kind's context of
the cluster prowes-conquest and points to its API server
(tests/integration/conquest/kind.sh), so check.sh needs kind too.
The first run pulls Conquest's Snakemake runner and task images (about
900 MB each) and its WDL runner image (miniwdl), which takes a few
minutes; the WDL tasks run in a Debian image pinned by digest in the
workflows (miniwdl runs task commands with bash). Dependabot updates none
of Conquest's images, nor PostgreSQL's and versitygw's in cluster.yaml,
nor the Debian image of the WDL workflows: to move to another Conquest
commit, set it in setup.sh and the digests of its sha-<commit> images
in values.yaml; a new Debian image takes a change of the workflows (see
WORKFLOW_REVISION below).
Where Conquest differs from WES 1.1.0, the test accommodates it:
- It runs workflows only from GitHub repositories
(
https://github.com/<org>/<repo>), which it clones, and checks out the commit of the workflow engine parameterrevision;snakefile(SMK) ormain_workflow_path(WDL) names the workflow file in the repository. The test's runs name this repository and a commit of itsdevbranch with the workflows (WORKFLOW_REVISIONofcheck.sh): commits of pull requests, e.g., of forks, aren't in a clone of the repository. A change to the workflows therefore takes two pull requests: one that changes them, and, once it's merged, one that movesWORKFLOW_REVISIONto its commit. - 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. Its entry in the config overlay states the version with the labelwes.version: "1.1.0"(see WES versions). - It takes the version of Snakemake as the version of the workflow type
(
SMK,9.17.3), which the config overlay adds to proWES'sworkflow_type_versions, with WDL1.0. - Its run logs have no exit code, and
stdoutis ans3://URL of its object store; the test checks the exit code of the run's task at Conquest (GET /runs/{run_id}/tasks). Only WDL runs list outputs, ass3://URLs; the test reads the WDL greeting from the S3 server. - Its Nextflow runs (
NFL) aren't covered: Conquest's Nextflow runner hands the repository to Nextflow (nextflow run <repository> -r <revision> -main-script <main_script>), and Nextflow 24.10.4, which it runs, refuses a repository withoutmain.nf(or anextflow.confignaming another main script) at its root, before it applies-main-script. This repository has neither, so anNFLrun of the WESkit test's Nextflow scripts ends inEXECUTOR_ERRORbefore any task runs (generic-issues#194).
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 and WESkit's Redis of the
integration tests) 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).
- WESkit of the integration test, built from the commit of a release and its base image's digest (see WESkit).
- Conquest of the integration test: the commit of its chart and the digests of its images, and the images of PostgreSQL and versitygw (see Conquest).
- The versions of Helm and kind (
versionof their actions) in the jobschart,chart-installandintegration, which must stay the same. - 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.