Installation¶
MicroGridsPy is distributed as a standard Python package and requires Python ≥ 3.10.
Recommended installation¶
Install MicroGridsPy together with a solver extra. The open-source HiGHS solver is the recommended default:
Available extras¶
| Extra | Installs | Use it for |
|---|---|---|
highs |
highspy |
open-source LP/MILP solver (recommended) |
gurobi |
gurobipy |
commercial solver (requires a license) |
gui |
streamlit |
the optional Streamlit graphical workspace |
dev |
pytest, ruff, pre-commit, coverage, build |
development and testing |
docs |
zensical, mkdocstrings-python |
building this documentation |
all |
everything above | full installation |
Combine extras with commas, e.g. pip install "microgridspy[highs,gui]".
Solvers
MicroGridsPy builds the optimization model with Linopy, which hands the problem to
a backend solver. At least one solver extra (highs or gurobi) must be installed to
actually solve a model. Gurobi additionally requires a valid license.
Console entry points¶
Installing the package exposes two commands:
microgridspy # command-line interface
microgridspy-gui # launch the Streamlit workspace (needs the [gui] extra)
Development installation¶
To work on MicroGridsPy itself, clone the repository and install it in editable mode with the development and solver extras:
git clone https://github.com/MicroGridsPy/MicroGridsPy.git
cd MicroGridsPy
pip install -e ".[highs,dev]"
The version number is derived from git tags via hatch-vcs, so a source checkout without
tags reports a development version.
Documentation development¶
To build this documentation locally, install the docs extra and run the Zensical
development server from the repository root:
pip install -e ".[docs]"
zensical serve # live-reloading preview at http://127.0.0.1:8000
zensical build # static build into ./site
The API Reference is generated by mkdocstrings, which reads the
package statically from src/ (paths = ["src"] in zensical.toml) via
Griffe — so the package does not need to be
installed for the docs to build. The same commands are used by Read the Docs (see
.readthedocs.yaml), keeping local and hosted builds reproducible.