Development¶
Environment with uv¶
The project uses uv for dependency and
environment management. The dev dependency group includes the tooling needed
to work on the project (linting, type checking, docs).
Sync the environment, including dev dependencies:
Run any project command inside the managed environment with uv run:
Pre-commit hooks¶
If you want to contribute to this repository, please set up pre-commit.
The hooks run automatically on every commit. To run them against the whole repository on demand:
Testing¶
Tests live in tests/, one file per module (test_data.py, test_weather.py, ...),
and run with pytest:
Warnings are errors.
By default, only fast, local tests are ran.
To run tests that require network access (e.g. downloading weather data), use the network tag:
To run slow tests (e.g. solving large complex plants), use the slow tag:
Binary test fixtures (e.g. a small atlite cutout) go under tests/fixtures/, one
subdirectory per dataset, alongside the script that regenerates them.
Style¶
Documentation¶
All docstrings follow the Google docstring convention. Example docstring:
def lcoe(capex: float, opex: float, energy: float, rate: float = 0.07):
"""Compute levelised cost of energy.
Args:
capex: Capital expenditure (EUR)
opex: Annual operating expenditure (EUR/yr)
energy: Annual energy yield (MWh/yr)
rate: Discount rate as a decimal fraction (_)
Returns:
LCOE (EUR/Mwh)
Raises:
ValueError: If ``energy`` is negative
For an exhaustive specification of this docstring style, see the Google Python Style Guide.
Documentation¶
Local¶
We use zensical for documentation. To build it the docs, simply run:
And to serve them and inspect locally:
Online¶
Online docs are built by a GitHub CI, .github/workflows/docs.yml and published under https://mrmorawski.github.io/technoeconomics.