Skip to main content

An open-source modular framework for ingesting, standardising, storing, and computing energy-related data.

Project description

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.

Setup

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

Configure

Quick start

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.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 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).

Full example

The demo/ directory contains a complete working application that ties everything together.

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

Run development demo application:

Our 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 demo

Code style checks:

poe lint    # Check code style
poe format  # Format code
poe check   # Run type checks

Run tests:

poe test

Build & publish

We 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cofy_api-0.6.0.tar.gz (23.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cofy_api-0.6.0-py3-none-any.whl (32.7 kB view details)

Uploaded Python 3

File details

Details for the file cofy_api-0.6.0.tar.gz.

File metadata

  • Download URL: cofy_api-0.6.0.tar.gz
  • Upload date:
  • Size: 23.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","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}

File hashes

Hashes for cofy_api-0.6.0.tar.gz
Algorithm Hash digest
SHA256 57810660cc3ed0db4e8f49e43fcb861fa6e6cf7980b9d0c1afad3857ed6a17c0
MD5 a099aae4e82fba13f7f2737d8f54b32c
BLAKE2b-256 3bfd13605b3dde58cb94b405a98a6916f1fc56803f4fd1a15bdbc46e3f24b29a

See more details on using hashes here.

File details

Details for the file cofy_api-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: cofy_api-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 32.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","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}

File hashes

Hashes for cofy_api-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4c58019f825083292bcff22b3001938ada6f1445a90cd8e333dfa98d57c2d087
MD5 d5f0a7fc35d378dff8dbd02f50e7e8b5
BLAKE2b-256 14ae1b45257b00036b756c1af0e833013901230b655d4d17f24d5a770e782b82

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page