Skip to main content

Cofy API

Cofy API is an open-source modular framework for ingesting, standardising, storing, and computing energy-related data.

This package contains the runtime API and module system: the piece you need for route 1 in the root README, running a single energy community yourself. If you'd rather start from a ready-made repo than from this package directly, see cofy-api-template.

Install

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]"

Quick start

Create an app.py file with a minimal Cofy API:

from cofy.api 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.py

The API is now available at http://127.0.0.1:8000 with interactive docs at /docs.

Authentication

Protect the API with bearer-token authentication:

from cofy.api import CofyAPI, TokenAuth, TokenInfo

app = CofyAPI(auth=TokenAuth({"my-secret-token": TokenInfo(name="Admin")}))

Clients authenticate via header (Authorization: Bearer my-secret-token) or query parameter (?token=my-secret-token).

Development

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.

Install/update dependencies:

First install uv if you don't have it yet.

Then install/update dependencies:

uv sync

Install poethepoet and pre-commit

uv tool install poethepoet
uv tool install pre-commit

Activate pre-commit hooks that enforce code style on every commit:

pre-commit install

Tests and linting

uv sync --group dev
poe test
poe lint
poe format
poe check

Metadata

Release files for cofy-api 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cofy-api 0.7.0
File Size Uploaded Provenance Actions
cofy_api-0.7.0.tar.gz 32.1 kB Without provenance Details for cofy_api-0.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cofy-api 0.7.0
File Interpreter ABI Platform Actions
cofy_api-0.7.0-py3-none-any.whl Python 3 none any Details for cofy_api-0.7.0-py3-none-any.whl

Total release size: 75.9 kB

Release files / cofy_api-0.7.0.tar.gz

Download URL cofy_api-0.7.0.tar.gz
Size 32.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a09fbce0e4dbb17033c72eb5542223677ebc59a4227812a40ca1c10d7e98d0a6
BLAKE2b-256 checksum
How to use checksums
ada929b12f94995c36245a7a3cd7018a4a43da72767825adcdcf7b05bbb7497a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / cofy_api-0.7.0-py3-none-any.whl

Download URL cofy_api-0.7.0-py3-none-any.whl
Size 43.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6e221ac106970fedbeb56df526e90763bbe22f27e054fa900f915313a95808a7
BLAKE2b-256 checksum
How to use checksums
919ff42e76c1f83df6b515f95cdb92be73446e13e10b07826806a0d057d21474
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for cofy-api 0.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page