uk-energy (Python)
Typed Python clients for the UK's public electricity data APIs. Mirrors the TypeScript packages in the same repo.
pip install uk-energy
Contains BMRS data © Elexon Limited copyright and database right 2026. Contains NESO Data Portal data, used under the NESO Open Data Licence. Carbon Intensity data © National Energy System Operator, CC BY 4.0.
See the repo README for the full attribution and licence notes.
Packages
| Module | Covers | Status |
|---|---|---|
uk_energy.core |
HttpClient / AsyncHttpClient on httpx: retries with jittered backoff, per-host rate limiting, pagination, pluggable cache, FixtureTransport for tests |
built, unpublished |
uk_energy.carbon_intensity |
Carbon Intensity API: CarbonIntensityClient / AsyncCarbonIntensityClient — national and regional intensity, forecasts, generation mix |
built, unpublished |
uk_energy.elexon |
Elexon Insights | planned |
uk_energy.neso |
NESO Data Portal | planned |
from uk_energy.core import HttpClient, MemoryCache, RateLimit
elexon = HttpClient(
"https://data.elexon.co.uk/bmrs/api/v1",
rate_limit=RateLimit(5, burst=10),
cache=MemoryCache(),
cache_ttl_s=60,
)
fuel = elexon.get("datasets/FUELINST", {"publishDateTimeFrom": "2026-10-20T00:00Z"})
from uk_energy.carbon_intensity import CarbonIntensityClient
ci = CarbonIntensityClient()
ci.intensity_current()["intensity"] # {"forecast": 125, "actual": 134, "index": "moderate"}
ci.regional_for_postcode("M1")["data"][0] # region 3, North West England
ci.intensity_forward48h("2026-10-15T00:00Z") # 97 half-hour periods
Note: intensity_for_date() uses a local GB day (BST in summer), and range endpoints include
the period containing from_; see the TypeScript package README for the full list.
Development
cd python
uv sync
uv run pytest # fixtures only, no network
UK_ENERGY_LIVE=1 uv run pytest -m live
uv run ruff check . && uv run mypy
Metadata
Release files for uk-energy 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| uk_energy-0.1.1.tar.gz | 63.2 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| uk_energy-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 85.4 kB
Release files / uk_energy-0.1.1.tar.gz
| Download URL | uk_energy-0.1.1.tar.gz |
|---|---|
| Size | 63.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
333e3d4b02418ce9d3b69ff14df8f3cd6309dd93a46139c2450690170fc9f7c3
|
|
BLAKE2b-256 checksum How to use checksums |
723166e468db3e84c49971f9e7030d86100000ab71af9ac3a04b413b76e19df2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logRelease files / uk_energy-0.1.1-py3-none-any.whl
| Download URL | uk_energy-0.1.1-py3-none-any.whl |
|---|---|
| Size | 22.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5df1e5ee47c5ebc2e41f0b338c6688b4328d8255322b00f6a6e51cfba39f38c2
|
|
BLAKE2b-256 checksum How to use checksums |
fb5f6e505fe9fdc23d60e422b692192d4dbae9cdb9a0980c54332f751631e016
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logSecurity for uk-energy 0.1.1
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for uk_energy-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logA 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.