Skip to content

Contributing

Repository layout

📦giFBA
 ┣ 📂package                    Installable "gifba" Python package
 ┣ 📂Examples
 ┃ ┣ 📂1_toy_models             Walkthroughs of giFBA on the 10 toy models (non-interacting, competition, cross-feeding, combined, coupling)
 ┃ ┣ 📂2_real_models             Notebooks applying giFBA to real AGORA2 communities (A. hallii/B. infantis & C. diff)
 ┃ ┃ ┗ 📂4_dfba_benchmark        Benchmark comparing giFBA to a clamped dynamic FBA (dFBA) implementation
 ┃ ┗ 📂figures                  Saved figures/network diagrams generated by the notebooks above
 ┣ 📂docs                     This documentation site (MkDocs)
 ┣ .github/workflows/tests.yml  CI: runs the package test suite on Python 3.10 and 3.13
 ┣ .github/workflows/docs.yml   CI: builds and deploys this site to GitHub Pages
 ┣ mkdocs.yml                   Docs site configuration
 â”— README.md

Package layout

📦package
 ┣ 📂gifba
 ┃ ┣ 📂Toy_Models          10 bundled 2-organism JSON models (non-interacting, competition, cross-feeding, coupling, ...)
 ┃ ┣ __init__.py           Public exports: gifbaObject, CommunitySummary
 ┃ ┣ config.py             Package-wide constants
 ┃ ┣ gifba_object.py       gifbaObject: the fixed-point giFBA simulation engine
 ┃ ┣ summary.py            CommunitySummary: post-run uptake/secretion reporting
 ┃ ┗ utils.py              Input validation, toy-model loader, minimal-medium search, MICOM/cFBA interop
 ┣ 📂tests
 ┃ ┣ conftest.py           Shared fixtures (toy_models, toy_community, run_toy), pinned to GLPK
 ┃ ┣ golden_values.py      Measured reference fluxes for the 10 toy models
 ┃ ┣ test_toy_models.py    End-to-end regression tests over the toy models
 ┃ ┣ test_summary.py       Tests for CommunitySummary
 ┃ ┗ test_validators.py    Tests for the utils.check_* input validators
 â”— pyproject.toml          Package metadata, dependencies, optional extras

Testing

Run from the repository root (the suite takes about 3 seconds):

python -m pytest package/tests               # full suite
python -m pytest package/tests -k validators  # solver-free subset
python -m pytest package/tests -x -q          # stop on first failure

CI (.github/workflows/tests.yml) runs the same suite on Python 3.10 and 3.13 with GLPK on every push and pull request.

  • tests/conftest.py pins the LP solver to GLPK. The golden values were measured under GLPK, and CI has no Gurobi license, so do not remove the pin.
  • tests/golden_values.py holds measured reference fluxes for the ten toy models. Treat a change there as deliberate: re-measure rather than hand-edit, and explain in the commit message why the numbers moved.
  • New tests should cover behaviour that works today. Known defects are tracked separately rather than encoded as xfail.

Docstrings and autodoc

Public modules, classes and functions should have Google-style docstrings and static type hints. The API Reference is generated from these docstrings by mkdocstrings, so a change to a public docstring shows up on the site at the next deploy. Members starting with _ are left out. To document a new public module, add a ::: gifba.<module> block to docs/api.md.

Building the docs

pip install mkdocs-material "mkdocstrings[python]"
mkdocs serve           # live preview at http://127.0.0.1:8000
mkdocs build --strict  # fail on broken links or missing pages

.github/workflows/docs.yml deploys the site to GitHub Pages on every push to main.

AI usage

Parts of this repository — including portions of the code, tests, and this documentation — were drafted & implemented with the assistance of AI coding tools (Claude Code). All AI-assisted contributions are reviewed by the project maintainers, and the underlying scientific method, model validation, and numerical results (e.g. unit testing) are checked against expected biological/mathematical behavior rather than taken on faith from generated output.