From 7bc9ba174f002aaa85a6b2542f87635e990fd399 Mon Sep 17 00:00:00 2001
From: GeiserX <9169332+GeiserX@users.noreply.github.com>
Date: Tue, 17 Nov 2026 17:21:46 +0100
Subject: [PATCH 01/12] refactor(steps): find Stranger's bundled catalog with
find, not Python
Step 9b and the STRANGER module asked the image's Python where the
stranger package lives. Find the catalog under the lib directory of the
prefix the stranger command is installed in instead. Same path in the
pinned image; more than one match or none stops the step.
Bead: port-vendor-oneliners
---
modules/local/stranger/main.nf | 5 ++++-
scripts/09b-stranger.sh | 6 +++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/modules/local/stranger/main.nf b/modules/local/stranger/main.nf
index a62551b04..cee7d5e7c 100644
--- a/modules/local/stranger/main.nf
+++ b/modules/local/stranger/main.nf
@@ -43,7 +43,10 @@ process STRANGER {
# the bundled GRCh38 catalog.
CATALOG="${cat}"
if [ -z "\$CATALOG" ] || ! grep -q '"NormalMax"' "\$CATALOG"; then
- CATALOG=\$(python -c 'import os, stranger; print(os.path.join(os.path.dirname(stranger.__file__), "resources", "variant_catalog_grch38.json"))')
+ # The package sits under the lib directory of the prefix the stranger
+ # command is installed in. Exactly one match, or the -f test stops.
+ STRANGER_BIN=\$(command -v stranger)
+ CATALOG=\$(find "\${STRANGER_BIN%/bin/*}/lib" -path '*/site-packages/stranger/resources/variant_catalog_grch38.json')
fi
echo "Repeat catalog: \$CATALOG"
if [ ! -f "\$CATALOG" ]; then
diff --git a/scripts/09b-stranger.sh b/scripts/09b-stranger.sh
index 8d52e9b64..59880b526 100755
--- a/scripts/09b-stranger.sh
+++ b/scripts/09b-stranger.sh
@@ -82,11 +82,15 @@ stranger_run() {
"/genome/${SAMPLE}/expansion_hunter/${SAMPLE}_eh.vcf"
else
echo "Repeat catalog: bundled GRCh38 clinical catalog (variant_catalog_grch38.json)"
+ # The catalog sits in the stranger package, under the lib directory of
+ # the prefix the stranger command is installed in. Exactly one match, or
+ # the step stops.
# shellcheck disable=SC2016 # the dollar signs are for the container's sh
atomic_out "$OUT_VCF" run_in \
--cpus 1 --memory 1g \
"${STRANGER_IMAGE}" \
- sh -c 'catalog=$(python -c "import os, stranger; print(os.path.join(os.path.dirname(stranger.__file__), \"resources\", \"variant_catalog_grch38.json\"))") &&
+ sh -c 'bin=$(command -v stranger) &&
+ catalog=$(find "${bin%/bin/*}/lib" -path "*/site-packages/stranger/resources/variant_catalog_grch38.json") &&
[ -f "$catalog" ] || { echo "ERROR: no GRCh38 catalog in the Stranger image (${catalog:-not found})" >&2; exit 1; }
exec stranger --repeats-file "$catalog" "$1"' \
stranger "/genome/${SAMPLE}/expansion_hunter/${SAMPLE}_eh.vcf"
From 32789220e9c9600f1644ee12811c2f75997070fc Mon Sep 17 00:00:00 2001
From: GeiserX <9169332+GeiserX@users.noreply.github.com>
Date: Tue, 17 Nov 2026 17:21:46 +0100
Subject: [PATCH 02/12] refactor(steps): find the cnvpytor data directory and
Cyrius version without Python
Step 18, the CNVPYTOR module and the CNVpytor image test find the
package data directory with find under the cnvpytor command's prefix,
and require exactly one. The module now stops when none is found instead
of copying the resources to /. The Cyrius image test reads the installed
version from the wheel's METADATA.
Bead: port-vendor-oneliners
---
modules/local/cnvpytor/main.nf | 9 ++++++++-
scripts/18-cnvpytor.sh | 10 ++++++++--
tests/smoke/cnvpytor.sh | 5 ++++-
tests/smoke/cyrius.sh | 3 ++-
4 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/modules/local/cnvpytor/main.nf b/modules/local/cnvpytor/main.nf
index fbf888a0f..ddb91c019 100644
--- a/modules/local/cnvpytor/main.nf
+++ b/modules/local/cnvpytor/main.nf
@@ -47,7 +47,14 @@ process CNVPYTOR {
# the image's site-packages, so this step needs a writable container FS —
# run with the docker profile (the shell script bind-mounts instead, and
# Singularity's read-only image is not supported for this step).
- DATADIR=\$(python -c 'import cnvpytor, os; print(os.path.dirname(cnvpytor.__file__) + "/data")')
+ # The package sits under the lib directory of the prefix the cnvpytor
+ # command is installed in; exactly one data directory, or the step stops.
+ CNVPYTOR_BIN=\$(command -v cnvpytor)
+ DATADIR=\$(find "\${CNVPYTOR_BIN%/bin/*}/lib" -type d -path '*/site-packages/cnvpytor/data')
+ if [ ! -d "\$DATADIR" ]; then
+ echo "ERROR: no single cnvpytor data directory in the image (\${DATADIR:-not found})" >&2
+ exit 1
+ fi
cp -f ${cnvpytor_resources}/*.pytor "\$DATADIR"/
cnvpytor -root ${meta.id}.pytor -rd ${bam} -chrom ${canonical_chroms} -j ${task.cpus}
diff --git a/scripts/18-cnvpytor.sh b/scripts/18-cnvpytor.sh
index d39d3393f..7fe86d085 100755
--- a/scripts/18-cnvpytor.sh
+++ b/scripts/18-cnvpytor.sh
@@ -20,7 +20,7 @@ BIN_SIZE=1000
# The pinned biocontainer ships WITHOUT the reference GC/mask resources and its
# built-in `-download` is broken in 1.3.2, so we bind-mount pre-fetched pinned
# files onto the container's package data dir. That directory depends on the
-# image's Python version, so it is asked from the image below, not written here.
+# image's Python version, so it is found in the image below, not written here.
echo "=== CNVpytor: ${SAMPLE} ==="
echo "Input BAM: ${BAM}"
@@ -54,8 +54,14 @@ done
mkdir -p "$OUTPUT_DIR"
+# The package sits under the lib directory of the prefix the cnvpytor command
+# is installed in. The container prints the directory only when exactly one
+# matches.
+# shellcheck disable=SC2016 # the dollar signs are for the container's sh
CNVPYTOR_IMG_DATA=$(run_in "${CNVPYTOR_IMAGE}" \
- python -c 'import cnvpytor, os; print(os.path.dirname(cnvpytor.__file__) + "/data")' | tail -n 1)
+ sh -c 'bin=$(command -v cnvpytor) &&
+ d=$(find "${bin%/bin/*}/lib" -type d -path "*/site-packages/cnvpytor/data") &&
+ [ -d "$d" ] && echo "$d"')
case "$CNVPYTOR_IMG_DATA" in
/*/cnvpytor/data) ;;
*)
diff --git a/tests/smoke/cnvpytor.sh b/tests/smoke/cnvpytor.sh
index f7c0bb07b..301c8a8aa 100644
--- a/tests/smoke/cnvpytor.sh
+++ b/tests/smoke/cnvpytor.sh
@@ -5,7 +5,10 @@
# directory; the mini reference matches no genome they describe, so empty
# files stand in for them here.
set -e
-D=$(python -c 'import cnvpytor, os; print(os.path.dirname(cnvpytor.__file__) + "/data")' | tail -n 1)
+# The package's data directory, found as step 18 finds it.
+B=$(command -v cnvpytor)
+D=$(find "${B%/bin/*}/lib" -type d -path '*/site-packages/cnvpytor/data')
+[ -d "$D" ] || { echo "no single cnvpytor data directory: '${D}'" >&2; exit 1; }
echo "resource directory: ${D}"
for f in gc_hg19 mask_hg19 gc_hg38 mask_hg38 gc_chm13v2.0 gc_chm13v1.1 gc_kn99; do
[ -e "${D}/${f}.pytor" ] || touch "${D}/${f}.pytor"
diff --git a/tests/smoke/cyrius.sh b/tests/smoke/cyrius.sh
index ef9a0fb84..1cc3a1e0a 100644
--- a/tests/smoke/cyrius.sh
+++ b/tests/smoke/cyrius.sh
@@ -9,7 +9,8 @@ set -e
: "${CYRIUS_VERSION:?versions.env sets it}"
pip install --no-cache-dir --disable-pip-version-check -q --require-hashes --no-deps \
--only-binary :all: --target /out/cyrius -r /in/cyrius-constraints.txt
-PYTHONPATH=/out/cyrius python3 -c 'import importlib.metadata as m; print("cyrius", m.version("cyrius"))' > installed.txt
+# The version pip installed, from the wheel's own metadata.
+printf 'cyrius %s\n' "$(sed -n 's/^Version: //p' /out/cyrius/cyrius-*.dist-info/METADATA)" > installed.txt
cat installed.txt
echo /in/HG002_cyrius.bam > manifest.txt
PYTHONPATH=/out/cyrius python3 -m cyrius --manifest manifest.txt --genome 38 --prefix HG002_cyp2d6 --outDir /out --threads 4
From b15cd3c77a00fb623810aa89b5a978316317b05c Mon Sep 17 00:00:00 2001
From: GeiserX <9169332+GeiserX@users.noreply.github.com>
Date: Tue, 17 Nov 2026 17:38:40 +0100
Subject: [PATCH 03/12] feat(og-dev): og dev site-check, the docs site check in
Rust
The checks of .github/scripts/site-check.py, ported with the same ERROR
lines: dangling links and images, missing fragments, .md links, rooted
links outside the prefix, stray pages, published Python, count tokens,
tags that hide the page, copy buttons, the home page, site_url, and the
zensical.toml plugin, feature, variant, redirect and llmstxt checks.
Bead: port-site-check
---
rust/crates/og-dev/src/lib.rs | 7 +-
rust/crates/og-dev/src/site_check.rs | 2446 ++++++++++++++++++++++++
rust/crates/og-dev/tests/site_check.rs | 522 +++++
3 files changed, 2974 insertions(+), 1 deletion(-)
create mode 100644 rust/crates/og-dev/src/site_check.rs
create mode 100644 rust/crates/og-dev/tests/site_check.rs
diff --git a/rust/crates/og-dev/src/lib.rs b/rust/crates/og-dev/src/lib.rs
index 27067a8d2..bf311ec37 100644
--- a/rust/crates/og-dev/src/lib.rs
+++ b/rust/crates/og-dev/src/lib.rs
@@ -40,6 +40,9 @@
//! ([`licences`]), `og dev docs-check` ([`docs_checks`]),
//! `og dev stub-http` ([`stub_http`]) and `og dev steps-check`
//! ([`steps_check`]).
+//! - `og dev site-check SITE [ZENSICAL_TOML]` ([`site_check`]): the built
+//! docs site and `zensical.toml`, for what `zensical build --strict` does
+//! not check.
//! - `og dev traits-sources` ([`traits_sources`]): the traits panel's
//! reference bases against a FASTA, and its PubMed ids and rsIDs against
//! PubMed and dbSNP.
@@ -68,6 +71,7 @@ pub mod renovate;
pub mod report_only;
pub mod schema;
pub mod shlex;
+pub mod site_check;
pub mod smoke;
pub mod steps_check;
pub mod stub_http;
@@ -78,7 +82,7 @@ mod zip;
use std::io::Write;
-const USAGE: &str = "usage: og dev parity-compare KIND ORACLE NEW\n og dev parity-compare --self-test\n og dev contract --static [--repo DIR] [--contract FILE]\n og dev contract --outputs DIR --leg bash|nextflow --sample S [--observe]\n og dev schema SCHEMA.json DOC.json\n og dev report-only [--repo DIR]\n og dev remnants [--list FILE] [--root DIR]\n og dev fixture comphet|trim-pharmcat [args]\n og dev evidence clashes|hg002-gvcf [args]\n og dev renovate-check LOG [--pins FILE] [--repo DIR]\n og dev helpers --list|--static|--images|--orad-calls [--root DIR]\n og dev helpers --orad --help-file FILE [--orad-version V] [--root DIR]\n og dev build cn-intervals|callability|sv-rule-regions|roh-af|acmg-lof [args]\n og dev scan personal-data|images [args]\n og dev versions check-run|expand|coupled [args]\n og dev pgs trait|label-match|metric-match [args]\n\n og dev pharmcat diplotypes REPORT [--called|--called-lines]\n og dev nf-trace requests|attempts TRACE [options]\n og dev smoke mini-ref|long-reads|eh-catalog|csv-cell|check [args]\n og dev demo-sample [args]\n og dev demo-events [args]\n og dev params-doc [args]\n og dev python-gate [args]\n og dev everything-check [args]\n og dev licences [args]\n og dev docs-check [args]\n og dev stub-http [args]\n og dev steps-check [args]\n og dev traits-sources [--table T] [--fasta F [--min-fasta-rows N]] [--online]";
+const USAGE: &str = "usage: og dev parity-compare KIND ORACLE NEW\n og dev parity-compare --self-test\n og dev contract --static [--repo DIR] [--contract FILE]\n og dev contract --outputs DIR --leg bash|nextflow --sample S [--observe]\n og dev schema SCHEMA.json DOC.json\n og dev report-only [--repo DIR]\n og dev remnants [--list FILE] [--root DIR]\n og dev fixture comphet|trim-pharmcat [args]\n og dev evidence clashes|hg002-gvcf [args]\n og dev renovate-check LOG [--pins FILE] [--repo DIR]\n og dev helpers --list|--static|--images|--orad-calls [--root DIR]\n og dev helpers --orad --help-file FILE [--orad-version V] [--root DIR]\n og dev build cn-intervals|callability|sv-rule-regions|roh-af|acmg-lof [args]\n og dev scan personal-data|images [args]\n og dev versions check-run|expand|coupled [args]\n og dev pgs trait|label-match|metric-match [args]\n\n og dev pharmcat diplotypes REPORT [--called|--called-lines]\n og dev nf-trace requests|attempts TRACE [options]\n og dev smoke mini-ref|long-reads|eh-catalog|csv-cell|check [args]\n og dev demo-sample [args]\n og dev demo-events [args]\n og dev params-doc [args]\n og dev python-gate [args]\n og dev everything-check [args]\n og dev licences [args]\n og dev docs-check [args]\n og dev stub-http [args]\n og dev steps-check [args]\n og dev site-check SITE_DIR [ZENSICAL_TOML]\n og dev traits-sources [--table T] [--fasta F [--min-fasta-rows N]] [--online]";
/// Python's `str(OSError)`: `[Errno 2] No such file or directory: 'path'`.
pub(crate) fn py_os_error(e: &std::io::Error, path: &str) -> String {
@@ -211,6 +215,7 @@ pub fn main(args: &[String]) -> u8 {
Some("docs-check") => run(docs_checks::cli, &args[1..]),
Some("stub-http") => run(stub_http::cli, &args[1..]),
Some("steps-check") => run(steps_check::cli, &args[1..]),
+ Some("site-check") => run(site_check::cli, &args[1..]),
Some("traits-sources") => run(traits_sources::cli, &args[1..]),
Some("-h" | "--help") => {
print!("{USAGE}");
diff --git a/rust/crates/og-dev/src/site_check.rs b/rust/crates/og-dev/src/site_check.rs
new file mode 100644
index 000000000..c7af06e1e
--- /dev/null
+++ b/rust/crates/og-dev/src/site_check.rs
@@ -0,0 +1,2446 @@
+//! `og dev site-check SITE [ZENSICAL_TOML]`: the post-build check of the
+//! Zensical docs site, for the rules `zensical build --strict` does not
+//! enforce. It replaces `.github/scripts/site-check.py` with the same checks
+//! and the same ERROR lines.
+//!
+//! Run it from the repository root (the Docs workflow does): the config is
+//! read from `./zensical.toml` unless its path is given. No config file is
+//! an error, never a skipped pass.
+//!
+//! Exit 1 on any of these, each printed as one `ERROR` line:
+//! - a link or image whose target is not in the built site: a nav entry
+//! whose page does not exist, a missing image, any other dangling href or
+//! src, in any quoting and with HTML entities decoded. A full URL into the
+//! site itself (`https://geiserx.github.io/