Cofy Cloud is an open-source modular framework for ingesting, standardising, storing, and computing energy-related data, designed to run anywhere from local deployments to cloud environments.
Right now this is very much a work in progress. With the development of a first proof of concept. This is not ready for production use and the api is likely to change significantly in the near future.
pip install "cofy-api[all]"Cofy is modular — install only what you need via extras. Example — install with only the tarrif and members modules:
pip install "cofy-api[tariff,members]"Create an app.py with a minimal Cofy API:
from cofy import CofyAPI
from cofy.modules.tariff import TariffModule
app = CofyAPI()
app.register_module(TariffModule(api_key="YOUR_ENTSOE_KEY", name="entsoe"))Run it:
fastapi dev app.pyThe API is now available at http://127.0.0.1:8000 with interactive docs at /docs.
Protect the API with bearer-token authentication:
from fastapi import Depends
from cofy import CofyAPI
from cofy.api import token_verifier
app = CofyAPI(
dependencies=[Depends(token_verifier({"my-secret-token": {"name": "Admin"}}))]
)Clients authenticate via header (Authorization: Bearer my-secret-token) or query parameter (?token=my-secret-token).
The demo/ directory contains a complete working application that ties everything together.
We use astral python tooling for our development environment. We use poethepoet to define some essential tasks. The demo run task is also available as vscode execution task, making it easy to run and debug the demo application from within vscode.
First install uv if you don't have it yet.
Then install/update dependencies:
uv syncInstall poethepoet and pre-commit
uv tool install poethepoet
uv tool install pre-commitActivate pre-commit hooks that enforce code style on every commit:
pre-commit installOur demo application uses some API keys for external services. You can provide these .env.local file in the root of the repository, following the structure of .env.example.
poe demopoe lint # Check code style
poe format # Format code
poe check # Run type checkspoe testWe use a github action to create a new tag, github release and publish to pypi. Trigger the action manually from the actions tab, and provide the new version number as input.