This project is packaged as pypsa-bc and managed with uv, a fast Python package/project manager. This guide walks through installing uv and setting up the project from a fresh clone.
macOS / Linux:
curl -LsSf https://astral.sh/uv/install.sh | shWindows (PowerShell):
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"Alternatively, if you already have Python and pip/pipx:
pipx install uv
# or
pip install uvVerify the install:
uv --versiongit clone https://github.com/DeltaE/PyPSA_BC.git
cd PyPSA_BCuv reads pyproject.toml and .python-version in the repo root. It will automatically download the pinned Python version (3.12) if it isn't already installed, create a .venv, and install all project dependencies plus the pypsa-bc package itself in editable mode:
uv syncThis produces:
.venv/— the project's virtual environmentuv.lock— a locked, reproducible set of dependency versions (commit this file)
To include development dependencies (pytest, ipykernel, etc.), uv sync already installs the dev dependency group by default. To skip them:
uv sync --no-devUse uv run to execute anything inside the managed environment without manually activating it:
uv run python run_pypsa_bc.py
uv run snakemake -s workflow/snakefile
uv run jupyter labOr activate the virtual environment directly:
source .venv/bin/activate # macOS/Linux
.venv\Scripts\activate # WindowsAdd a new runtime dependency:
uv add <package>Add a development-only dependency:
uv add --dev <package>Update the lockfile after changing pyproject.toml by hand:
uv lockUpgrade all dependencies to their latest allowed versions:
uv lock --upgrade- The project previously used a conda environment (
env/environment.yaml) and asetup.py. These have been superseded bypyproject.toml+uv.lock. The conda environment file is kept for reference only. - Python version is pinned via
.python-version(3.12) to match the geospatial/scientific stack (geopandas,rasterio,atlite, etc.) most reliably.