| Age | Commit message (Collapse) | Author |
|
Cargo.toml pins gn-rust-correlation 12c2a37 from the genenetwork forge
(refs/heads/main there; GitHub still sits at 473ad82). The lock grows by
exactly the four packages this brings in -- correlation_rust, GSL,
GSL-sys, assert_approx_eq -- and nothing else moves.
Following the xapian-rs precedent for a git dependency, since guix's
cargo build is offline and the registry replacement only knows crates.io:
- rust-package.scm gains the git origin as a bare `origin' (not a
crate-source: unpack-rust-crates copies a *directory* input into
guix-vendor/, so a checkout is exactly what it wants), plus crate
sources for the three new registry crates;
- guix.scm lists them and adds a second source-replacement stanza beside
xapian's, keyed `git+<url>?rev=<rev>` because cargo resolves a git source
by the exact id in Cargo.lock;
- both git checkouts get the empty `.cargo-checksum.json` stub;
- gsl is a native input: the p-values come from GSL's t-distribution
through rgsl, found with pkg-config at build time.
One fix in the vendoring phase itself: the gawk that back-fills package
checksums named vendor directories from the lock entry verbatim, which is
right for lowercase crates with no underscores and wrong for `GSL` and
`GSL-sys` (crate-source lowercases, via crate-name->package-name). It
lowercases now, so the two agree.
Cargo cannot fetch this repo at all -- its HEAD is dangling, so cargo's
"fetch HEAD and every head" fails where guix's fetch-by-sha does not.
Generating the lock therefore needed CARGO_NET_OFFLINE with the crate
pre-cloned into ~/.cargo/git/db; nothing about that affects the build,
which vendors the checkout.
|
|
Phase 0 of the R/qtl2 work, so the engine can be exercised before any
endpoint exists. `r-qtl2` (0.42 in this channel) plus `r-digest`/`r-jsonlite`
go into the dev shell's propagated inputs; without them R has to be handed a
list of 594 store paths by hand to load qtl2 at all.
`scripts/qtl2_scan.R` is written for this API rather than copied from
GeneNetwork3's `scripts/rqtl2_wrapper.R`, which cannot be trusted as a
reference: its `"LMM"` and `"LOCO"` branches call `scan1` with identical
arguments, its covariates are a `covar <- NULL; # TODO` stub, and its only
tests mock the file-writing helpers -- nothing ever reads a cross.
The script reads a qtl2 control file, a two-column phenotype file and
optional covariates, and writes `marker,chr,pos,lod` (Mb, so the shape
matches /compute/rqtl and /plot/rqtl draws it unchanged). Genotype
probabilities and the kinship matrices are cached in --cache-dir keyed by
the control file's content, because a DO cross costs 536 s of genotype
probabilities on four cores against 11 s of kinship.
Four things the cross-file plumbing cost, all found by running it:
* `read_cross2` joins the control file's directory onto whatever paths it
finds, so an absolute path becomes `<dir>/<absolute>` and dies. The server
has to write the control file *beside* its data;
* our generated genotypes are markers-in-rows, which needs
`"geno_transposed": true` -- without it qtl2 reads the individuals as
markers (93 individuals appear as 93 extra markers, and every marker is
"not in both genotypes and maps");
* the genotype strings need a `"genotypes"` map (the GN letters
@mat/@het/@pat -> A/H/B -> 1/2/3); without it every value is "treated as
missing" and the scan comes back flat (peak LOD 0.14);
* with those fixed, a cross converted from `genotype/BXD.4.geno` scans in
~1 s and agrees with /compute/rqtl on the same panel and trait: qtl2's LMM
peaks on chr8 at ~111 Mb, LOD 3.50, where R/qtl's HK `scanone` peaks on
chr8 at ~69 Mb, LOD 2.93 -- same chromosome, different model, which is the
cross-check the plan asks for.
Not yet: the Rust side (`src/qtl2.rs`), the `/compute/qtl2` route, the
genotypes-listing `qtl2` flag and the converter that writes the control
file. Those are Phase 1-3.
|
|
The xapian-rs git revision Cargo.toml pins was written against Xapian
1.4: it generates bindings for Xapian::InMemory::open, which Xapian 2.0
removed (2.x spells it as the Xapian::DB_BACKEND_INMEMORY flag), and
autocxx then aborts with "the 'generate' or 'generate_pod' directive for
'Xapian::InMemory::open' did not result in any code being generated".
2.x's headers also need C++17, where autocxx hands the parser a fixed
-std=c++14 that 1.4's headers accept. Guix's own xapian has moved to
2.1.0, so guix build -f guix.scm stopped working; pin the last 1.4
release instead of tracking it.
* guix.scm (xapian-1.4): new variable, Xapian 1.4.29 inheriting
xapian's inputs, with 1.4's own check targets.
(genenetwork4-git)[inputs]: use xapian-1.4.
(use-modules): (guix download), for url-fetch.
* README.md (Running with cargo): "Building with cargo, outside a bare
toolchain", the guix shell -D variables that a bare cargo build lacks.
(Running with Guix): why xapian is pinned, and when to drop it.
|
|
* rust-package.scm: regenerate with 'guix import crate -f Cargo.lock
genenetwork4', bringing the crate set in sync with Cargo.lock (the
gemma/auth work bumped tokio, which added signal-hook-registry 1.4.8).
* guix.scm (native-inputs): add rust-signal-hook-registry-1.4.8.
Without these the vendored build aborts at patch-cargo-checksums
(missing guix-vendor/rust-signal-hook-registry-1.4.8.tar.gz). Verified
hermetic: guix time-machine -C channels.scm -- build -L ~/guix-bioinformatics
-f guix.scm -> /gnu/store/7gk50nkrlyd3sc52bra48j70i5hb031z-genenetwork4-git-0.1.0
|
|
Same request/response shape as /compute/gemma: synchronous (no job
queue), ?id= + GET /compute/rqtl/status/{run_id} progress-streaming.
Extracted that streaming infrastructure (run_streaming, create_run_log/
RunLogError, status/StatusError, RunStatus/RunStatusParams,
is_valid_run_id, COMPLETION_MARKER) out of src/gemma.rs into a new
src/streaming.rs so both compute endpoints share it instead of
duplicating it; src/routes/gemma.rs updated to the shared names,
confirmed its own 8 tests still pass unchanged.
scripts/rqtl_wrapper.R is GeneNetwork3's script, copied here verbatim
and run via Rscript -- same reasoning as reusing gemma-wrapper rather
than reimplementing GEMMA. Scope: a single scan (scanone) plus, if
nperm > 0, its permutation thresholds (67th/95th percentile, via a
Rust port of numpy.percentile's default linear interpolation) -- the
common case. Not implemented: covariates, interval mapping,
permutation strata, pair-scan (scantwo) -- scantwo in particular needs
cross-referencing the genotype file for nearest-marker lookups and a
second (MAP_) output file, a materially bigger port than this covers.
One fix relative to GeneNetwork3, found by reading the code (no test
covers the real caller's keys): generate_rqtl_cmd's content hash only
ever looks at kwargs keyed "g"/"p", but gn3/api/rqtl.py's real caller
uses keys "geno"/"pheno" -- they never match, so the genotype/
phenotype file contents never actually enter the cache-key hash in
production, only the other options. Two different phenotypes mapped
with the same other options would get the same cached output filename
and silently reuse each other's result. Fixed here: both files'
contents are always hashed (std DefaultHasher -- a cache key, not a
security boundary, so no need for GeneNetwork3's md5).
guix.scm: r, r-qtl, r-optparse, r-stringi and r-stringr added as
propagated-inputs (same category as gemma-wrapper, and same reasoning:
invoked as a subprocess, not linked). All stock Guix -- confirmed the
existing -L (needed only for gemma-wrapper, from guix-bioinformatics)
is not needed for these; the dev shell has Rscript/R-qtl on PATH from
guix.scm's own propagated-inputs alone.
Test fixture: a small, hand-written, valid BXD riset genotype/
phenotype pair (tests/test_data/rqtl_sample1.*), not GeneNetwork3's
own tests/unit/db/.../genotype_sample1.geno -- that fixture has a
genotype code outside its own header's declared set and duplicate
marker names across chromosomes, harmless for the unrelated parsing
unit it's written for there, but both would break a real R/qtl run.
Verified end to end, not just unit tested: tests/rqtl.rs runs the real
Rscript/R-qtl against that fixture (a real scanone scan, real
permutation thresholds with suggestive <= significant, the run-id-
collision 409 pre-seeded with no Rscript needed, and the completion
marker landing in a real log after the run finishes). cargo test
passes in full.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
|
|
|
rust-package.scm: the git origin becomes rust-xapian-rs-0.3.0.70c5eac
(write-API patch set + the document-termlist-only eager positions
fix; hash taken fresh from the pushed revision). guix.scm: the
source-replacement stanza rev and the origin input follow. The
offline vendored build resolves against the new rev END-to-end
(guix build -f guix.scm EXIT 0).
|
|
Maps a QTL from a genotype file, a SNP annotation file and trait
values, by running gemma-wrapper's K-matrix step then its LMM
association step, both synchronously (axum/tokio awaits the subprocess
directly, no job queue needed) and returning the parsed .assoc.txt
rows in the standard envelope.
Both steps use a bare --loco (gemma-wrapper derives the chromosome
list from the SNP annotation file). This was arrived at empirically,
not from GeneNetwork3's or GeneNetwork2's own gemma code: run for real
against the BXD fixtures,
- GeneNetwork3's gn3/computations/gemma.py composes a GWA command that
always keeps "-gk" alongside "-lmm"; real GEMMA rejects that
combination outright ("only one of -gk ... -lmm ... options is
allowed"), so none of its gwa-compute/k-gwa-compute endpoints can
produce output. Unsurprising: tests/integration/test_gemma.py is
entirely @unittest.skip, so this was never exercised.
- GeneNetwork2's wqflask/marker_regression/gemma_mapping.py correctly
omits "-gk" from the GWA step, but its non-LOCO branch fails too,
the same way my own first (non-LOCO) attempt did: gemma-wrapper only
ever archives a non-LOCO kinship matrix into a .tar.xz, with no
loose file at the path its own non-LOCO GWA code assumes
("Enforce failed for file_kin ... open file"). Only --loco, which
gemma-wrapper's own USAGE banner documents and which does unpack
that archive, actually works.
A --loco run's .assoc.txt files (one per chromosome) are themselves
only ever inside gemma-wrapper's own output archive, never loose, so
gemma.rs shells out to `tar` (one of gemma-wrapper's own propagated
dependencies) to extract them before concatenating all chromosomes'
rows into the response.
guix.scm now depends on (gn packages gemma) from guix-bioinformatics
for gemma-wrapper (propagated-input: it's invoked as a subprocess, not
linked, and this makes it land in a consuming profile too, same as
GeneNetwork3's and GeneNetwork2's own packages do it). That dependency
needed guix-bioinformatics' own gn/packages/gemma.scm fixed first (see
that repo's fix/gemma-which-shadowing branch) -- gemma-gn2 would not
build at all before that fix.
Verified end to end: `cargo test` passes in full, including a real
(non-mocked, non-skipped) run of gemma-wrapper/GEMMA against the BXD
fixtures copied from genenetwork3/tests/test_data, producing exactly
7320 association rows (one per marker in BXD_snps.txt) in ~19s.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
|
autocxx-bindgen with libclang 22 mis-parses Xapian 1.4.29: the C++ it
generates for xapian-rs instantiates the abstract Xapian::Weight (via
a bogus std::vector<Xapian::Weight> bridge) and emits an out-of-scope
'::op', so the build failed in the cargo build phase. The xapian-rs
fork was built (and target/ produced) with libclang 13.0.1, whose
parse is correct. Depend on clang-13 and point LIBCLANG_PATH at it in
the set-duckdb-paths phase. (clang-13's package name is "clang", so
it replaces the clang-22 input rather than colliding with it.)
Also create the scratch directory in tests/embedded.rs: the SQLite test
opened test.db under a directory that did not exist yet.
guix build -f guix.scm now completes end to end (Rust check phase and
the Python REST suite), producing
/gnu/store/3avgh789ffy3lrfiql334dghp9sa4sqd-genenetwork4-git-0.1.0.
|
|
Add src/embedded.rs with lmdb/duckdb/sqlite round-trip helpers and
tests/embedded.rs integration tests: an LMDB put/get (surviving a
fresh environment handle), an in-memory DuckDB query, and a SQLite
query.
Depend on the system libraries rather than bundled builds:
duckdb 1.10506.0, lmdb 0.8.0 and rusqlite 0.40.2 with their default
features, so the Guix build reuses libduckdb/liblmdb/libsqlite3 instead
of compiling its own.
Guix wiring (guix.scm): add the duckdb, lmdb and sqlite inputs
((gnu packages duckdb)/(gnu packages databases)/(gnu packages sqlite)),
a set-duckdb-paths phase that points libduckdb-sys at the system
libduckdb via DUCKDB_LIB_DIR/DUCKDB_INCLUDE_DIR (there is no
duckdb.pc), and the 79 new crate sources in rust-package.scm
(regenerated with `guix import crate -f Cargo.lock genenetwork4`).
|
|
Guix attempt 5 got past the check phase (195.6 s, the full hermetic
suite green — the E0596/XGb6/ZXD test fixes held inside the build)
and died in the install phase instead: cargo-build-system's install
runs `cargo install --offline --no-track --path .', and cargo install
RE-RESOLVES the dependency graph, refusing to reuse the in-tree
Cargo.lock for the source-replaced git dependency xapian-rs
("the source git+... requires a lock file to be present first before
it can be used against vendored source code", drv 7s1h7nrj,
logs/guix-attempt5.log) — even though the lock sits in the source
root, restored by patch-cargo-checksums, and the build/check phases
consumed it happily.
Root cause proven on a minimal offline repro (vendored git dep, clean
CARGO_HOME, guix-env cargo 1.85.1; /tmp/inst-repro): `cargo build
--offline' EXIT=0 with the same layout, `cargo install --offline
--no-track --path .' fails with the byte-identical error, and the
same command with `--locked' succeeds — --locked makes cargo trust
and reuse the existing lock instead of re-resolving.
Fix: replace the stock install phase with the same invocation plus
--locked (everything else mirrors the stock phase for a bin-only
crate with #:install-source? #f: mkdir out, CARGO_TARGET_DIR=./target,
--no-track --path . --root out). Validated: primitive-load of the
recipe + dry-run lowering of the new derivation (drv gzz9sds5).
This obstacle is distinct from attempts 1-4 (vendoring/check-phase
test code): it is the install phase's re-resolution, understood and
proven offline before this attempt, within the retry cap for a new
obstacle.
|
|
Two defects in the checksum-writing awk program, both caught by the
guix build attempts and both re-validated against the real lock before
this commit:
1. The program was committed as raw single-quote text instead of a
double-quoted Scheme string: the quotes inside the program
terminated and re-opened the form, and guile read
sprintf("%c", 34) as a string followed by an unquote — the builder
died at evaluation ("unquote: expression not valid outside of
quasiquote"). A --dry-run does NOT catch this class of error (it
lowers the derivation but never evaluates the builder); the
validation that matters is running the exact decoded program
against the real lock.
2. Lock package names may contain underscores (cfg_aliases, cookie_store,
...) while guix import emits hyphenated origin file-names
(rust-cfg-aliases-0.2.2.tar.gz); the program now gsub(_ -> -).
Verified exhaustively: every one of the 287 checksum-bearing lock
entries maps to an existing vendor directory, and the decoded
program writes all 287 .cargo-checksum.json files with valid JSON
and byte-identical checksums.
|
|
Guix build attempt 3 (logs/guix-c1-3.log) got past the git-source
resolution and failed on checksum verification: the restored
Cargo.lock records every registry package's crates-io checksum, but
the stock patch-cargo-checksums {"files":{}} stub provides none —
"unable to verify that hashbrown v0.12.3 is the same as when the
lockfile was generated".
The replaced patch-cargo-checksums now writes each vendored crate's
.cargo-checksum.json as {"files":{},"package":"<checksum>"} with the
checksum read straight out of the restored lock (each vendor
directory is named after its lock entry, both generated from the same
lock by guix import crate). The per-file map stays empty — the same
trust model as the stock stub; only the package-level checksum cargo
verifies against the lock is real. The awk program builds the JSON
quotes/backslashes via %c so it needs no escaped literals (a first
draft double-escaped them; caught by running the exact program
against the real lock before committing, not after a 40-minute guix
cycle). The git checkout keeps a plain {"files":{}} stub.
The exact guix-style flow was re-proven offline end to end before this
commit: cold cargo cache, files:{} + lock-sourced package checksums,
cargo build --offline EXIT 0 (full recompile, 1m25s).
|
|
teach the vendor phase to restore Cargo.lock.
House rule (rust-package.scm header): regenerate whenever Cargo.lock
changes. The cxx-gen 0.7.198 -> 0.7.124 pin swaps two crate sources
(cxx-gen itself, codespan-reporting 0.13.1 -> 0.11.1) and drops
unicode-width 0.2.2; guix.scm's native-inputs follow. 288 crate
sources plus the xapian-rs git origin, matching the lock exactly.
The first guix build attempt of this recipe failed inside
vendor-vendored-git-dep: the build-side environment has no (ice-9
ftw), so the phase now finds the vendored checkout with find-files
from (guix build utils) (attempt 1, logs/guix-c1-3.log). The second
failed in the build phase: cargo-build-system deletes Cargo.lock at
configure, but cargo refuses to resolve a git dependency against
vendored sources without one -- "the source git+... requires a lock
file to be present first" (attempt 2, same log + drv log). The phase
now restores the committed lock from the source store path. The whole
mechanism (lock + vendor dir + cargo-vendor git-source stanza +
checksum stub, fully offline) was proven outside guix first: cargo
build --offline EXIT 0 against the vendored graph, xapian-rs
compiling from the vendored git checkout.
|
|
rust-package.scm regenerated per the house header (guix import crate -f
Cargo.lock genenetwork4) for the C1.1 lock: 289 exported crate sources
(223 existing + 66 new) plus the xapian-rs git origin
(rust-xapian-rs-0.3.0.97fd343, Alexanderlacuna fork at rev 97fd343,
sha256 the recipe lane proved -- see ~/spikes/xapian-guix-recipe/
RECIPE-REPORT.md).
guix.scm: new (inputs (list xapian)) -- the vendored xapian-rs build
script locates it through pkg-config and the cxx bridge links
libxapian into genenetwork4 itself; clang (libclang for the autocxx
codegen) and pkg-config join native-inputs, mirroring the proven
standalone fork recipe; the 66 new crate sources join native-inputs.
The git dependency needs two things the old cargo-build-system does
not do by itself (empirically confirmed with cargo vendor on this
lock): a source-replacement stanza mapping the git source onto the
vendored directory, and a .cargo-checksum.json stub in the copied
checkout (registry crates carry one inside their .crate; a git
checkout does not). A new vendor-vendored-git-dep phase adds both,
appending exactly the stanza cargo vendor emits.
Gate: guix build -f guix.scm under the pinned channels with
substitutes in ci.guix.gnu.org-first order; evidence
~/spikes/port-execution/logs/guix-c1-3.log.
|
|
reqwest is the HTTP client for the phase-A search proxy (pure-Rust
TLS, no system OpenSSL, per the sandbox-hermetic convention);
serde_json is promoted from a dev-dependency; url percent-encodes
forwarded queries.
* Cargo.lock rust-package.scm guix.scm (packaging): regenerate the
crate mirror from the lock (guix import crate -f Cargo.lock
genenetwork4); add the 35 new crate sources to the inputs list.
All four artifacts move as one unit so cargo's and guix's views of
the dependency set can never drift or be half-reverted.
|
|
* Cargo.toml (jsonwebtoken, ureq): New dependencies, RS256 JWT
verification and gn-auth's HTTP API respectively. ureq pulls in ring
for RSA verification, needing a C compiler at build time -- already
provided by cargo-build-system's standard inputs, nothing added to
guix.scm for it. Promote serde_json from dev-dependencies to
dependencies; src/auth.rs needs it outside tests now.
(mysql-common-derive, simple_asn1, time): Pin to the newest versions
still compatible with the Guix-packaged rustc 1.85.1 (same trap as
before: ureq's dependency chain pulls darling 0.23/time 0.3.46+, both
needing rustc 1.88).
* rust-package.scm: Regenerate with `guix import crate -f Cargo.lock
genenetwork4`.
* guix.scm (genenetwork4-git)[native-inputs]: Update crate list to
match.
* src/auth.rs (AuthToken): New extractor. Verifies a bearer token's
RS256 signature and standard time claims (exp/nbf, checked only when
present -- gn-auth's own validator treats them as optional too)
against gn-auth's JWKS, cached and refreshed periodically
(OnceLock<Mutex<HashMap<...>>>, same shape as db::pool()) rather than
fetched per request.
(is_publicly_readable): New function. Matches GeneNetwork2's own
threshold (public > 0 AND confidentiality < 1, used throughout
wqflask/api/router.py) for whether a dataset needs an authorization
check at all; InbredSet/group rows carry a public column too, but GN2
never filters on it, so groups/species endpoints need no gating.
(authorise): New function. Wraps gn-auth's POST
/auth/resource/authorisation, caching the per-(user, resource) answer
briefly (AUTHORISATION_TTL) so repeated requests for the same resource
by the same user don't each cost a round trip. Not yet called from any
route -- see RELEASE_NOTES.md.
* src/config.rs (Config)[auth_server_url]: New field, AUTH_SERVER_URL
config key, matching GeneNetwork3's own key of the same name.
* src/error.rs (ApiError): Derive Debug; needed by tests/auth.rs's
.unwrap() on a Result<_, ApiError>, and every error type should
implement it regardless.
* src/lib.rs: Register the new auth module.
* tests/auth.rs: New file. Runs AuthToken verification and authorise()
(including its cache) against a real gn-auth instance; set
GN4_TEST_AUTH_TOKEN/GN4_TEST_RESOURCE_ID (see docs/gn-auth.md), skips
otherwise.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XDDpXvZBQat9uSgDeEMJ8d
|
|
Guix's rust package is 1.85.1; crates.io has since published newer
mysql_common, utoipa, utoipa-axum and transitive-dependency releases
that only compile on rustc 1.88+ (mysql_common's own let-chains and
is_multiple_of usage, utoipa-gen's darling 0.23 dependency, and
icu_*/idna_adapter/uuid bumps pulled in via url/mysql). None of that
is reachable by relaxing darling/icu/uuid alone -- mysql_common itself
needs downgrading, which drags mysql with it.
* Cargo.toml (mysql): 28.0.3 -> 26.0.1, the newest release still on
mysql_common 0.35.x (0.36.x and 0.37.x both use let-chains/
is_multiple_of, stable only from rustc 1.88).
(utoipa): 6.0.0 -> 5.5.0, (utoipa-axum): 0.3.0 -> 0.2.0, the newest
pre-6.0 utoipa line (MSRV 1.75); utoipa-gen 6.x's darling 0.23
dependency (MSRV 1.88) comes along with utoipa 6.x.
* Cargo.lock: Regenerate for the above; icu_collections,
icu_locale_core, icu_normalizer, icu_normalizer_data, icu_properties,
icu_properties_data, icu_provider, idna_adapter and uuid also drop to
their newest rustc-1.85.1-compatible releases as a result.
* rust-package.scm: Regenerate with `guix import crate -f Cargo.lock
genenetwork4`.
* guix.scm (genenetwork4-git)[native-inputs]: Update crate list to
match.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XDDpXvZBQat9uSgDeEMJ8d
|
|
* Cargo.toml (dependencies): Add tower-http, features request-id and
util.
* src/error.rs: New file. ApiError, modeled on RFC 7807 (Problem
Details for HTTP APIs) plus code, operation_id, spec_url, request_id
and next. type and spec_url are relative paths since this service has
no fixed public domain. Implements axum::response::IntoResponse.
* src/lib.rs (app): Add SetRequestIdLayer and PropagateRequestIdLayer,
assigning each request an x-request-id and copying it onto the
response.
(request_id_string): New function.
(species, species_by_name): Take an Extension<RequestId> parameter.
Return Result<_, ApiError> instead of Result<_, (StatusCode, String)>.
(species_by_name): On no match, set ApiError's next to /species, so a
caller with a wrong species name can discover the valid ones.
* tests/species_by_name.rs (species_by_name_unknown_species_returns_404):
Check the full ApiError body (status, code, operation_id, spec_url,
next) and that request_id matches the x-request-id response header,
instead of only the status code.
* test/python/test_species_by_name.py
(test_species_by_name_unknown_species_returns_404): Likewise.
* README.md: Add an Error handling section documenting the ApiError
shape and each field.
* rust-package.scm: Regenerate with guix import crate -f Cargo.lock
genenetwork4. Adds crate-source definitions for tower-http and its
new transitive dependencies.
* guix.scm (genenetwork4-git)[native-inputs]: Add rust-tower-http-0.7.1,
rust-getrandom-0.4.3 and rust-r-efi-6.0.0.
|
|
* Cargo.toml (dependencies): Add utoipa, feature axum_extras; add
utoipa-axum.
* src/lib.rs: Use utoipa_axum::router::OpenApiRouter and routes!
instead of axum::Router and route!, so paths register into an OpenApi
document as well as the router.
(ApiDoc): New struct, deriving utoipa::OpenApi with title, description
and license.
(app): Add /openapi.json, serving the OpenApi document split out of
OpenApiRouter via split_for_parts.
(hello_world, version, species): Add #[utoipa::path(...)] attributes
describing each endpoint's responses.
(VersionInfo): Derive utoipa::ToSchema in addition to Serialize.
* src/db.rs (Species): Likewise.
* tests/openapi.rs: New file. Checks /openapi.json's info.title and
that it lists all three endpoints.
* test/python/test_openapi.py: New file. Likewise.
* README.md: Document /openapi.json.
* rust-package.scm: Regenerate with guix import crate -f Cargo.lock
genenetwork4. Adds crate-source definitions for utoipa, utoipa-gen,
utoipa-axum and pastey.
* guix.scm (genenetwork4-git)[native-inputs]: Add rust-utoipa-6.0.0,
rust-utoipa-gen-6.0.1, rust-utoipa-axum-0.3.0 and rust-pastey-0.2.3.
|
|
* Cargo.toml (dependencies): Add mysql, default-features = false,
features minimal-rust and derive (minimal pulls in flate2/zlib, which
fails to compile here; minimal-rust uses flate2's pure-Rust backend
instead).
* Cargo.lock: Regenerate. Picks up mysql and its roughly 100
transitive dependencies; also bumps libc to 0.2.190 and tokio to
1.53.2 from re-resolution.
* src/db.rs: New file. sql_uri, Species, get_all_species. Mirrors
GeneNetwork3's gn3.db.species.get_all_species: same query, same
ordering. Connection string from the SQL_URI environment variable
(same config key GeneNetwork3 uses), defaulting to
mysql://webqtlout:webqtlout@127.0.0.1/db_webqtl.
* src/lib.rs (app): Add /species route.
(species): New handler. Runs db::get_all_species on a blocking
thread, since mysql::Conn is synchronous.
* tests/species.rs: New file. Checks for a database on
127.0.0.1:3306 first and skips with a message instead of failing when
none is reachable, since the Guix build sandbox has no network.
* test/python/test_species.py: New file. Likewise.
* README.md: Document /species, SQL_URI, and the skip-without-database
behavior of species.rs and test_species.py.
* rust-package.scm: Regenerate with guix import crate -f Cargo.lock
genenetwork4. Adds crate-source definitions for mysql's transitive
dependencies; bumps rust-libc and rust-tokio to the versions above.
* guix.scm (genenetwork4-git)[native-inputs]: Add every new
rust-package.scm entry mysql pulled in (roughly 100 packages,
including rust-mysql-28.0.3, rust-mysql-common-0.37.3, rust-uuid,
rust-url, rust-sha1, rust-sha2, rust-flate2).
|
|
* README.md: New file. Documents endpoints, running with cargo,
running with guix, and the two test suites.
* guix.scm: Add (add-to-load-path (dirname (current-filename))) before
use-modules, so (rust-package) resolves whether or not -L . is passed
on the command line.
Update header comment's guix shell example from -C -D to -D, pointing
to README.md for why -C is not recommended here.
|
|
* .gitignore: Add __pycache__.
* src/lib.rs (app): Add /version route.
(VersionInfo, version): New struct and handler, returning name,
short_name, version, release, date, and git as a JSON record.
* build.rs: New file. Embeds GN4_GIT_HASH and GN4_COMMIT_DATE via
cargo:rustc-env, read from git rev-parse and git show of HEAD.
* Cargo.toml (dependencies): Add serde with derive feature.
[dev-dependencies]: Add serde_json.
* tests/version.rs: New file.
* test/python/server_test_case.py: New file. ServerTestCase,
wait_for_port, BINARY, HOST, PORT moved here from
test/python/test_hello_world.py.
* test/python/test_hello_world.py: Use server_test_case.ServerTestCase
instead of duplicating setUpClass and tearDownClass.
* test/python/test_version.py: New file.
* guix.scm: Add (gnu packages version-control) to use-modules.
(genenetwork4-git)[native-inputs]: Add git-minimal.
(genenetwork4-git)[arguments]<#:phases>[python-rest-test]: Run
test/python with python3 -m unittest discover instead of invoking
test_hello_world.py directly, so test_version.py also runs.
|
|
* src/main.rs (main): Read GENENETWORK4_PORT environment variable
for the listen port, default to 3000.
* test/python/test_hello_world.py: New file.
* guix.scm: Add (gnu packages python) to use-modules.
(genenetwork4-git)[native-inputs]: Add python.
(genenetwork4-git)[arguments]<#:phases>: Add 'python-rest-test
phase after 'install, running test/python/test_hello_world.py
against the installed binary on port 3737.
|
|
|