Skip to content

Commit eee7b8e

Browse files
authored
docs: set up Sphinx + ReadTheDocs and reorganize the documentation (#13)
Reorganize docs/ into a Diátaxis-style tree (guide / reference / studies / maintenance / archive) and add a Sphinx + MyST documentation site wired for ReadTheDocs. Site / toolchain: * .readthedocs.yaml + docs/conf.py (furo, MyST-Parser, autodoc + napoleon for the NumPy-style docstrings, intersphinx to cobra/numpy/pandas/scipy). * docs/requirements.txt; docs/index.md landing page + master toctree. * Full API reference auto-generated from docstrings — one automodule page per subpackage, honoring each __all__. * 7 task-oriented user-guide pages + quickstart; section index pages. * CHANGELOG.md / IMPROVEMENTS.md are {include}-d into the site. Link hygiene (the move + include changed relative depth): * All intra-docs cross-links updated to the new section paths. * Repo-file links (src/scripts/tests) and the included root files use absolute GitHub URLs so they resolve on both GitHub and the RTD site. * README/CHANGELOG/IMPROVEMENTS doc links remapped to the new paths. Quality / CI: * Tiny docstring formatting fixes (blank line before Parameters / bullet lists, literal block in binaries.py) so autodoc renders cleanly. Build is warning-clean under `sphinx-build -W`. * New `docs` CI job builds the site with `-W --keep-going`.
1 parent 41c2b72 commit eee7b8e

60 files changed

Lines changed: 1142 additions & 253 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,20 @@ jobs:
4646
# skip themselves when ``optlang.gurobi_interface`` cannot import.
4747
- run: pip install -e ".[dev,plotting,excel]"
4848
- run: pytest -q --maxfail=5 --durations=20
49+
50+
docs:
51+
name: docs
52+
runs-on: ubuntu-latest
53+
steps:
54+
- uses: actions/checkout@v4
55+
- uses: actions/setup-python@v5
56+
with:
57+
python-version: "3.12"
58+
cache: pip
59+
cache-dependency-path: pyproject.toml
60+
- run: pip install --upgrade pip
61+
# The package (with autodoc's import-time extras) plus the docs toolchain.
62+
- run: pip install -e ".[excel,plotting]" -r docs/requirements.txt
63+
# ``-W --keep-going`` keeps the docs build warning-clean; mirrors the
64+
# ReadTheDocs build (docs/conf.py + .readthedocs.yaml).
65+
- run: sphinx-build -b html -W --keep-going docs docs/_build/html

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ env/
2222
.DS_Store
2323
Thumbs.db
2424

25+
# Docs build output
26+
docs/_build/
27+
2528
# Tooling caches
2629
.claude/
2730

.readthedocs.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# ReadTheDocs build configuration
2+
# https://docs.readthedocs.io/en/stable/config-file/v2.html
3+
version: 2
4+
5+
build:
6+
os: ubuntu-24.04
7+
tools:
8+
python: "3.12"
9+
10+
sphinx:
11+
configuration: docs/conf.py
12+
# Build fails on warnings would be too strict while the API docstrings are
13+
# still being filled in; keep warnings visible but non-fatal.
14+
fail_on_warning: false
15+
16+
python:
17+
install:
18+
# Install the package itself (with the optional extras autodoc needs to
19+
# import every module) plus the docs-only toolchain.
20+
- method: pip
21+
path: .
22+
extra_requirements:
23+
- excel
24+
- plotting
25+
- requirements: docs/requirements.txt
26+
27+
formats:
28+
- pdf
29+
- htmlzip

CHANGELOG.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Changelog
22

33
Milestones in the raven-python port. For function-level status see
4-
[docs/raven_migration.md](docs/raven_migration.md); for open work see
5-
[docs/todo.md](docs/todo.md).
4+
[docs/raven_migration.md](https://github.com/SysBioChalmers/raven-python/blob/develop/docs/reference/migration.md); for open work see
5+
[docs/todo.md](https://github.com/SysBioChalmers/raven-python/blob/develop/docs/reference/todo.md).
66

77
## Infrastructure
88

9-
* **GitHub Actions CI** ([.github/workflows/ci.yml](.github/workflows/ci.yml)) —
9+
* **GitHub Actions CI** ([.github/workflows/ci.yml](https://github.com/SysBioChalmers/raven-python/blob/develop/.github/workflows/ci.yml)) —
1010
ruff + pytest matrix over Python 3.11/3.12/3.13. Tests that require Gurobi
1111
auto-skip (no Gurobi on free runners); the known HiGHS upstream blocker
1212
(`hybrid_interface.Configuration` rejects `lp_method='primal'`) is marked
@@ -33,7 +33,7 @@ fixes with matching MATLAB back-port proposals in IMPROVEMENTS.md (FS4, B2).
3333
bug to `check_model`; the actual code is in `balance.py`.
3434

3535
Two new regression tests (F3 in `test_analysis_fseof.py`, F5 in
36-
`test_utils_balance.py`). [docs/known_issues.md](docs/known_issues.md) now
36+
`test_utils_balance.py`). [docs/known_issues.md](https://github.com/SysBioChalmers/raven-python/blob/develop/docs/reference/known_issues.md) now
3737
fully closed (all sections A–F).
3838

3939
## Quality sweep — known-issues sections C / D / E
@@ -68,7 +68,7 @@ download (defensive, needs urlopen mocking).
6868

6969
## Quality sweep — known-issues section B
7070

71-
Closed all four "silent misbehaviour" items from [docs/known_issues.md](docs/known_issues.md):
71+
Closed all four "silent misbehaviour" items from [docs/known_issues.md](https://github.com/SysBioChalmers/raven-python/blob/develop/docs/reference/known_issues.md):
7272
* `merge_models` warns on `formula` / `charge` conflicts when two source models
7373
share a name[comp] but disagree (used to silently keep the first-seen).
7474
* `add_reactions_from_equations` warns when creating a metabolite in an
@@ -82,7 +82,7 @@ Four new regression tests cover them.
8282

8383
## Quality sweep — known-issues section A
8484

85-
Closed all six "latent edge-case bug" items from [docs/known_issues.md](docs/known_issues.md):
85+
Closed all six "latent edge-case bug" items from [docs/known_issues.md](https://github.com/SysBioChalmers/raven-python/blob/develop/docs/reference/known_issues.md):
8686
* `add_reactions_from_equations` no longer misparses `"2 oxoglutarate"` (or any
8787
leading-number metabolite name) — the resolver tries the full token before
8888
splitting off a coefficient.
@@ -101,45 +101,45 @@ Six new regression tests cover the user-reachable cases.
101101

102102
## Phase 7 — Localization
103103

104-
* **Sub-cellular localisation by MILP.** [`localization.predict_localization`](src/raven_python/localization/predict.py)
105-
+ [`apply_localization`](src/raven_python/localization/predict.py). Deterministic (not simulated
104+
* **Sub-cellular localisation by MILP.** [`localization.predict_localization`](https://github.com/SysBioChalmers/raven-python/blob/develop/src/raven_python/localization/predict.py)
105+
+ [`apply_localization`](https://github.com/SysBioChalmers/raven-python/blob/develop/src/raven_python/localization/predict.py). Deterministic (not simulated
106106
annealing); caller-passed `reactions_to_relocate` set with everything else pinned;
107107
incomplete-model tolerant (no silent reaction removal); `apply=False` returns a diff
108108
preview; multi-compartment by default with primary-free, extras-penalised scoring.
109-
* **Predictor loaders.** [`load_wolfpsort`, `load_deeploc`](src/raven_python/localization/scores.py),
109+
* **Predictor loaders.** [`load_wolfpsort`, `load_deeploc`](https://github.com/SysBioChalmers/raven-python/blob/develop/src/raven_python/localization/scores.py),
110110
with the `gene × compartment` DataFrame contract open for any predictor.
111-
* **Compartment helpers** ([`manipulation/compartments.py`](src/raven_python/manipulation/compartments.py)):
111+
* **Compartment helpers** ([`manipulation/compartments.py`](https://github.com/SysBioChalmers/raven-python/blob/develop/src/raven_python/manipulation/compartments.py)):
112112
`merge_compartments`, `copy_to_compartment` — useful standalone for model curation.
113-
* **Real-data validation on yeast-GEM** ([docs/yeast_localization_benchmark.md](docs/yeast_localization_benchmark.md))
113+
* **Real-data validation on yeast-GEM** ([docs/yeast_localization_benchmark.md](https://github.com/SysBioChalmers/raven-python/blob/develop/docs/studies/yeast_localization_benchmark.md))
114114
— accuracy 0.72 → 0.39 on 298 GPR'd reactions as confident predictor mis-scoring rises
115115
from 0 % to 50 %; perfect on compartments with disjoint gene sets (c/g/lp/p/v/vm), and
116116
surfaces a `transport_cost` calibration insight for soft-probability score tables.
117117

118118
## Phase 5 — Data integration & analysis
119119

120-
* **Reporter metabolites, FSEOF, random sampling** ([`analysis/`](src/raven_python/analysis/)).
121-
* **HPA omics ingestion** ([`omics.parse_hpa`, `parse_hpa_rna`, `hpa_gene_scores`, `rna_gene_scores`](src/raven_python/omics/hpa.py))
120+
* **Reporter metabolites, FSEOF, random sampling** ([`analysis/`](https://github.com/SysBioChalmers/raven-python/blob/develop/src/raven_python/analysis/)).
121+
* **HPA omics ingestion** ([`omics.parse_hpa`, `parse_hpa_rna`, `hpa_gene_scores`, `rna_gene_scores`](https://github.com/SysBioChalmers/raven-python/blob/develop/src/raven_python/omics/hpa.py))
122122
— pandas-tidy DataFrames replace RAVEN's sparse-matrix layout; scoring adapters reuse the
123123
existing GPR walk.
124-
* **N-model comparison** ([`comparison.compare_models`](src/raven_python/comparison/compare.py)).
124+
* **N-model comparison** ([`comparison.compare_models`](https://github.com/SysBioChalmers/raven-python/blob/develop/src/raven_python/comparison/compare.py)).
125125
* **Dynamic FBA** is **not ported** — established Python packages cover it (`dfba`,
126126
`reframed`, `mewpy`).
127127

128128
## Phase 4d — ftINIT
129129

130-
* **ftINIT pipeline** ([`init.ftinit`](src/raven_python/init/ftinit.py)) — staged MILP, linear merge,
130+
* **ftINIT pipeline** ([`init.ftinit`](https://github.com/SysBioChalmers/raven-python/blob/develop/src/raven_python/init/ftinit.py)) — staged MILP, linear merge,
131131
task-aware gap-filling, gene pruning.
132132
* **Validated against MATLAB RAVEN on Human-GEM.** 5 Hart2015 cell-line models;
133133
Jaccard 0.973–0.977 (no-task) and 0.978–0.980 (task-constrained). See
134-
[docs/humangem_validation.md](docs/humangem_validation.md).
135-
* **Parameter calibration & input-robustness study** ([docs/init_param_calibration.md](docs/init_param_calibration.md))
134+
[docs/humangem_validation.md](https://github.com/SysBioChalmers/raven-python/blob/develop/docs/studies/humangem_validation.md).
135+
* **Parameter calibration & input-robustness study** ([docs/init_param_calibration.md](https://github.com/SysBioChalmers/raven-python/blob/develop/docs/studies/init_param_calibration.md))
136136
`mip_gap=0.01` is the genome-scale full-pipeline sweet spot (~37% faster than 0.001 at
137137
Jaccard 0.995); pipeline is robust to expression noise (Jaccard 0.92–0.95) but sensitive
138138
to sparsity (50–70% dropout → Jaccard 0.59–0.71); the task + gap-fill layer keeps the
139139
essential-task pass-rate at 67–69/69 across the gradient, whereas tINIT-without-it passes
140140
only 35/69 even on clean data.
141-
* **Cross-solver portability** ([docs/init_solver_benchmark.md](docs/init_solver_benchmark.md))
142-
+ [`tests/test_init_solvers.py`](tests/test_init_solvers.py): Gurobi and GLPK pass at toy
141+
* **Cross-solver portability** ([docs/init_solver_benchmark.md](https://github.com/SysBioChalmers/raven-python/blob/develop/docs/studies/init_solver_benchmark.md))
142+
+ [`tests/test_init_solvers.py`](https://github.com/SysBioChalmers/raven-python/blob/develop/tests/test_init_solvers.py): Gurobi and GLPK pass at toy
143143
scale; only Gurobi is viable at genome scale today (HiGHS hits an upstream optlang
144144
`clone()` bug; GLPK ignores `configuration.timeout` on MIP).
145145
* **Engineering wins surfaced by the genome-scale work:** `check_tasks` and
@@ -149,25 +149,25 @@ Six new regression tests cover the user-reachable cases.
149149

150150
## Phase 4c — tINIT
151151

152-
* **INIT MILP and the tINIT pipeline** ([`init.run_init`](src/raven_python/init/init.py),
153-
[`init.get_init_model`](src/raven_python/init/build.py)). Clean optlang reformulation;
152+
* **INIT MILP and the tINIT pipeline** ([`init.run_init`](https://github.com/SysBioChalmers/raven-python/blob/develop/src/raven_python/init/init.py),
153+
[`init.get_init_model`](https://github.com/SysBioChalmers/raven-python/blob/develop/src/raven_python/init/build.py)). Clean optlang reformulation;
154154
RNA-seq scoring via `5·ln(level/ref)`-clamped.
155155

156156
## Phase 4b — Gap-filling
157157

158-
* **Connectivity gap-filling** ([`gapfilling.connect_blocked_reactions`](src/raven_python/gapfilling/fill.py))
158+
* **Connectivity gap-filling** ([`gapfilling.connect_blocked_reactions`](https://github.com/SysBioChalmers/raven-python/blob/develop/src/raven_python/gapfilling/fill.py))
159159
— MILP. Targeted (toward objective) mode delegates to `cobra.gapfill`.
160160

161161
## Phase 4a — Metabolic tasks
162162

163-
* **Task list parsing + `check_tasks`** ([`tasks/`](src/raven_python/tasks/)).
163+
* **Task list parsing + `check_tasks`** ([`tasks/`](https://github.com/SysBioChalmers/raven-python/blob/develop/src/raven_python/tasks/)).
164164

165165
## Phase 3 — Reconstruction
166166

167167
* **Homology-based draft** from a template GEM + BLAST/DIAMOND wrappers
168-
([`reconstruction/homology/`](src/raven_python/reconstruction/homology/)) — with structured
168+
([`reconstruction/homology/`](https://github.com/SysBioChalmers/raven-python/blob/develop/src/raven_python/reconstruction/homology/)) — with structured
169169
improvements over RAVEN's `getModelFromHomology` (see IMPROVEMENTS H1–H6).
170-
* **KEGG five-step pipeline** ([`reconstruction/kegg/`](src/raven_python/reconstruction/kegg/)):
170+
* **KEGG five-step pipeline** ([`reconstruction/kegg/`](https://github.com/SysBioChalmers/raven-python/blob/develop/src/raven_python/reconstruction/kegg/)):
171171
dump → parser → HMM library builder → species model → HMM-query draft.
172172
* **MetaCyc reconstruction** **not ported** (and flagged for removal from MATLAB RAVEN —
173173
see IMPROVEMENTS R-MetaCyc).
@@ -176,17 +176,17 @@ Six new regression tests cover the user-reachable cases.
176176

177177
* **YAML** aligned to cobra's `!!omap` writer + RAVEN-only fields preserved into `.notes`,
178178
plus geckopy `ec-*` for enzyme-constrained models
179-
([`io/yaml.py`](src/raven_python/io/yaml.py)).
179+
([`io/yaml.py`](https://github.com/SysBioChalmers/raven-python/blob/develop/src/raven_python/io/yaml.py)).
180180
* **SIF**, **Excel export**, and **Standard-GEM `model/<fmt>/…` git layout**
181-
([`io/`](src/raven_python/io/)). Excel import intentionally excluded.
181+
([`io/`](https://github.com/SysBioChalmers/raven-python/blob/develop/src/raven_python/io/)). Excel import intentionally excluded.
182182

183183
## Phase 1 — Foundation
184184

185-
* **GPR / balance / validation / parsing helpers** ([`utils/`](src/raven_python/utils/)) —
185+
* **GPR / balance / validation / parsing helpers** ([`utils/`](https://github.com/SysBioChalmers/raven-python/blob/develop/src/raven_python/utils/)) —
186186
cobra-absent bits only; the rest are cheatsheeted.
187-
* **Manipulation ergonomic layer** ([`manipulation/`](src/raven_python/manipulation/)) —
187+
* **Manipulation ergonomic layer** ([`manipulation/`](https://github.com/SysBioChalmers/raven-python/blob/develop/src/raven_python/manipulation/)) —
188188
add/change/remove/transport/transfer/merge/simplify/variance + adopted transforms.
189-
* **External-binary resolver** ([`binaries.py`](src/raven_python/binaries.py)) — version-pinned
189+
* **External-binary resolver** ([`binaries.py`](https://github.com/SysBioChalmers/raven-python/blob/develop/src/raven_python/binaries.py)) — version-pinned
190190
release-ZIP registry, SHA256-verified cache.
191191

192192
## Phase 0 — Scaffold

0 commit comments

Comments
 (0)