Getting Started¶
Four ways to use GSF, roughly in order of commitment:
- GSF Explorer — interactive model exploration in the browser, nothing to install.
- Tutorial gallery — notebooks in the browser.
- Run a tutorial locally — download one notebook, run it on your machine.
- Use as a package —
import globalsplinefitin your own code.
Install¶
uv add globalsplinefit # into a project
uv pip install globalsplinefit # into the active environment
New to uv? It is a fast drop-in replacement for pip and virtualenv — installation. Everything below works with plain pip too; pick the tab you prefer.
Note
Until the first PyPI release lands, install from GitHub instead:
What gets installed¶
The base package depends only on numpy and scipy — that is all you need to evaluate the model. Everything else is an optional extra:
| Install | Adds | For |
|---|---|---|
globalsplinefit |
numpy, scipy | using the model in your own code |
globalsplinefit[examples] |
matplotlib, marimo, nbformat, crflux | running the tutorial notebooks |
globalsplinefit[docs] |
mkdocs + the examples extra | building this documentation |
globalsplinefit[dev] |
test, docs and examples extras | contributing to the package |
Quick check:
import numpy as np
from globalsplinefit import GSFEnergy
gsf = GSFEnergy() # default: newest 2026 revision
print(gsf.flux(np.logspace(3, 5, 3), "p"))
See the User Guide for model classes, versions, and units.
Run a tutorial locally¶
Every page in the tutorial gallery ends with download buttons
for the notebook — as a marimo notebook (.py) or as a
Jupyter notebook (.ipynb). No clone required:
Prefer Jupyter? Download the .ipynb from the same page and open it with
jupyter lab.
The notebooks run unchanged locally: the cell that fetches the package inside the browser is skipped outside it, so your installed version is used.
Run the GSF Explorer locally¶
The Explorer is a static web app (Pyodide — Python in the browser). From a clone of the repository:
If you changed the package source, rebuild the wheel the Explorer loads
first: webapp/update_wheel.sh.
Build from source¶
For contributing to the package itself. Development uses
uv; uv.lock is committed.
git clone https://github.com/gsf-project/globalsplinefit.git
cd globalsplinefit
uv sync --all-extras # create/refresh .venv with all extras
uv run pytest tests/ # run the test suite
uv build # build sdist + wheel into dist/
Build and preview this documentation site:
The browser tutorials under /gallery/ are produced in CI by
marimo export html-wasm. To build the whole gallery locally with the same
script CI uses:
Each notebook is published twice: the app view at /gallery/<name>/ (figures
first, code behind the "Show code" menu item) and a full in-browser editor at
/gallery/<name>/edit/. CI additionally runs
.github/scripts/test_gallery.py, which loads every published page in a
headless browser and fails the build if a tutorial renders without figures —
a contributor check, not something you need in order to read the docs.