Open-source validation and calculation toolkit for EU CBAM data workflows
Project description
OpenCBAM Core
Open-source validation and calculation toolkit for EU CBAM data workflows.
The EU Carbon Border Adjustment Mechanism (CBAM) is a live regulation: from 2026, importers of covered goods owe a real, per-shipment financial liability tied to the embedded emissions of what they bring in. The numbers behind that liability — default values, benchmarks, free allocation, certificates due — come straight from EU regulation, but until now there has been no open, auditable reference implementation of them. OpenCBAM Core is that implementation: a stateless, dependency-free Python toolkit where every formula is traceable to a regulation and every result ships with a plain-language audit trail.
Contents
Install
pip install opencbam
Zero runtime dependencies — pure Python standard library, Python 3.10+. The optional openpyxl extra is
only needed to read .xlsx inputs (.csv works out of the box):
pip install "opencbam[xlsx]"
Quickstart
Python
Assess 100 t of steel wire rod imported from Türkiye, using default values, at an 80 EUR/t certificate price. The commented values below are the real output of running this snippet:
from decimal import Decimal
from opencbam import assess_good
from opencbam.engine.types import DataSource, Sector
r = assess_good(
cn_code="72071111",
country="Türkiye",
mass=Decimal("100"),
year=2026,
data_source=DataSource.DEFAULT,
sector=Sector.IRON_STEEL,
certificate_price=Decimal("80"),
)
r.embedded_emissions # Decimal("254.100") t CO2e
r.free_allocation # Decimal("132.990000") free allocation
r.certificates_due # Decimal("121.110") CBAM certificates
r.liability_eur # Decimal("9688.80") EUR at 80/t
r.audit # 5 human-readable trace lines explaining every step
Every field uses decimal.Decimal — never float — and r.audit explains each step in plain language, e.g.:
free allocation: benchmark 1.364 (Column B (default)) x CBAM_y 0.975 x CSCF 1 = SEFA 1.329900; FAA 132.990000
certificates due = max(0, 254.100 - 132.990000 - 0.000) = 121.110; liability = 9688.80 EUR @ 80/t
assess_good(...) is keyword-only and returns a typed GoodAssessment.
It raises ValueError for years before 2026.
CLI
Installing the package also installs the opencbam command (or run python -m opencbam). All six
subcommands work today.
Is a CN / commodity code covered by CBAM Annex I?
$ opencbam covered 72071111
72071111: covered
sector : iron_steel
good : Rolled or obtained by continuous casting of free-cutting steel
Run a full assessment from the shell — the same scenario as the Python example above:
$ opencbam calculate --cn 72071111 --country Türkiye --mass 100 --price 80
✓ 72071111 — Türkiye, 100 t (iron_steel, default values, year 2026)
embedded emissions : 254.100 t CO2e
free allocation : 132.990000 t CO2e
certificates due : 121.110 certificates
liability : 9688.80 EUR
audit trail:
· … 5 lines explaining every step (SEE, benchmark, free allocation, certificates, liability)
Validate a supplier file (.csv, or .xlsx with the opencbam[xlsx] extra):
$ opencbam validate examples/supplier-data.csv
✗ 8 rows validated
WARNING row 5 Duplicate of row 1 (same CN, country and shipment/installation id)
ERROR row 6 CN code '84073290' is not a CBAM Annex I covered good
ERROR row 7 Emissions value -15.0 is negative
ERROR row 8 Missing required field 'quantity'
3 error(s), 1 warning(s)
It exits non-zero when there are errors, so it drops cleanly into scripts and CI.
Score a file's data quality:
$ opencbam check-quality examples/supplier-data.csv
Data Quality Score: 60/100
Missing fields : 1
Invalid units : 1
Duplicate records : 1
Suspicious values : 0
Convert units with exact Decimal arithmetic: opencbam convert 5 MWh kWh prints 5000 kWh.
calculate, validate, and check-quality accept --json for machine-readable output. Extending the CLI
(more ERP connectors, --strict / --quiet, batch mode) is where many of the
good first issues live.
What's in the box
- Calculation engine — embedded emissions, attribution, free allocation, certificates due and EUR
liability via a single
assess_goodentry point. - Covered-goods + CN lookup —
is_covered_cn,lookup_good,sector_for_cn,search_goodsover the CBAM Annex I goods list. - Default values — marked-up default emission values by country and CN code (
get_default_value,get_marked_up_default,country_is_listed). - Electricity track — the CN 2716 imported-electricity methodology (
electricity_emission_factor,embedded_electricity, indirect grid factors). The IEA CC BY-NC-SA grid-factor data is not bundled; the code is, and you supply the factors under an appropriate licence (seedocs/DATA.md). - Data-quality grading (A–E) —
grade_emission_profile,grade_supplier_form,aggregatefor scoring how trustworthy a supplier's numbers are. - Unit conversions — exact,
Decimal-based conversion between CBAM quantity units. - Row-level validation — structured pass/fail checks over supplier data files.
- CLI — the
opencbamcommand-line tool. - Typed Python SDK — fully type-hinted (
py.typed), stdlib-only, ready to import.
Open core
OpenCBAM Core is the open, stateless calculation and validation core of the commercial IA Climate Ops CBAM platform. The numbers live here, in the open, where anyone can read and verify them. The platform builds the workflow, data, and collaboration layer on top.
| In this repo (Apache-2.0) | Added by the IA Climate Ops platform |
|---|---|
| Stateless calculation of embedded emissions, free allocation, certificates & liability | Client, facility and supplier management |
| Covered-goods / CN lookup, default values, electricity factors | Supplier portal for collecting primary data |
| Data-quality grading (A–E) | Annual declaration workflows |
| Unit conversion & row-level validation | CBAM certificate cockpit |
| CLI + typed Python SDK | Article 9 evidence vault & audit trail |
| Regulation-traceable formulas with audit trails | Multi-tenancy, RBAC, AI copilot / RAG, billing, consultant dashboard |
If you only need to compute or validate the numbers, this repo is all you need.
Grounded in regulation
Every formula and bundled dataset is traceable to a specific EU legal source, including:
- IR (EU) 2025/2620 — free-allocation benchmarks.
- IR (EU) 2025/2621 — default values, indirect and precursor emission factors, electricity factors.
- Reg (EU) 2023/956 — the CBAM Regulation and its Annex I covered-goods list.
The full source-to-code mapping is in SOURCES.md. The engine ships with 266 golden tests
that pin each calculation to its expected regulatory result, run on every push across Python 3.10–3.12.
Not legal advice
This software is not legal, tax or compliance advice, and is not affiliated with, endorsed by, or an official product of the European Union or any EU institution. Regulatory texts and default values change, and some figures (for example the cross-sectoral correction factor) are provisional until the Commission publishes final values. Always confirm results against the current official regulation and consult a qualified professional before relying on them for a declaration. Provided "as is" under the Apache-2.0 License, without warranty of any kind.
Contributing
Contributions are welcome — the CLI command surface, in particular, is a great on-ramp. Start with
CONTRIBUTING.md for setup, house style and the test workflow, and browse
docs/ISSUE_BACKLOG.md — good first issues welcome.
Maintained by IA Climate Ops.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file opencbam-0.1.0.tar.gz.
File metadata
- Download URL: opencbam-0.1.0.tar.gz
- Upload date:
- Size: 476.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a1a4b4b815cd8667cb479609631b599dd95a80ba6fb999c0affa54d63f0ade6
|
|
| MD5 |
3ef58090e2394ffa89fee166a435c0a3
|
|
| BLAKE2b-256 |
159c6d4e5fbff3f858bf710c341cdc1a33ec67a7d8ba52eeeead323bceb19004
|
Provenance
The following attestation bundles were made for opencbam-0.1.0.tar.gz:
Publisher:
release.yml on ia-climateops/opencbam-core
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
opencbam-0.1.0.tar.gz -
Subject digest:
2a1a4b4b815cd8667cb479609631b599dd95a80ba6fb999c0affa54d63f0ade6 - Sigstore transparency entry: 2142854239
- Sigstore integration time:
-
Permalink:
ia-climateops/opencbam-core@1030d2ff9b98202a1218130c4e6bee1455bcbf69 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ia-climateops
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1030d2ff9b98202a1218130c4e6bee1455bcbf69 -
Trigger Event:
release
-
Statement type:
File details
Details for the file opencbam-0.1.0-py3-none-any.whl.
File metadata
- Download URL: opencbam-0.1.0-py3-none-any.whl
- Upload date:
- Size: 469.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2e305439c5dc611bc5a6f2f0b417f3b0dc6b20caa8716a3300691abfc3be7fd
|
|
| MD5 |
3ed77d329e19d8555336095a5f5ff7af
|
|
| BLAKE2b-256 |
f78bcfc6522f438bc109cd579a3518357f5b628f025ef75b55133d50a48c410e
|
Provenance
The following attestation bundles were made for opencbam-0.1.0-py3-none-any.whl:
Publisher:
release.yml on ia-climateops/opencbam-core
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
opencbam-0.1.0-py3-none-any.whl -
Subject digest:
c2e305439c5dc611bc5a6f2f0b417f3b0dc6b20caa8716a3300691abfc3be7fd - Sigstore transparency entry: 2142854276
- Sigstore integration time:
-
Permalink:
ia-climateops/opencbam-core@1030d2ff9b98202a1218130c4e6bee1455bcbf69 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ia-climateops
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1030d2ff9b98202a1218130c4e6bee1455bcbf69 -
Trigger Event:
release
-
Statement type: