greencalculus
The official Python client for the GreenCalculus API — sourced greenhouse-gas emission factors and audit-traced calculations. Every value comes back with the exact place in the source it came from and the data version it was read at, so you hand back citable numbers, not guesses.
Zero third-party dependencies (standard library only).
Install
pip install greencalculus
No API key needed to read the corpus
from greencalculus import GreenCalculus
gc = GreenCalculus() # no key
f = gc.factor("grid.gbr.electricity.location_based")
print(f["value"], f["unit"]) # 0.13096 kg CO2e per kWh
print(f["factor"]["source"]["id"]) # DEFRA_2026
print(f["factor"]["source"]["cell_ref"]) # 'UK electricity'!E25
print(f["factor"]["citation"]["text"]) # the line you put in a report
print(f["factor"]["citation"]["proof_url"]) # a page your reader can check it on
value and unit are at the top level; the full sourced row is under
f["factor"], with ["source"], ["licence"] and ["citation"] inside it.
The shape of citation is specified and versioned: text,
source_id, cell_ref, version and proof_url. Print text verbatim —
it credits the upstream publisher first, which is what makes it usable in a
report someone else audits.
The same accessors work with or without a key — with one, the response
additionally carries provenance, attribution, verification and
proof_urls.
Don't know the key? Search — also keyless:
for row in gc.search("diesel litre", limit=5)["factors"]:
print(row["key"], row["factor"]["value"], row["factor"]["unit"])
Or browse a family:
gc.browse(key_prefix="grid.gbr", limit=20)
gc.browse(section="fuels", limit=50)
A free key adds calculations and version pinning
Get one at greencalculus.com/developers — 1,000 calls a month, no card.
gc = GreenCalculus(api_key="gc_live_...")
r = gc.ghg_activity(
activity={"value": 1000, "unit": "kWh"},
factor_key="grid.gbr.electricity.location_based",
)
print(r["emissions"]["value"], r["emissions"]["unit"])
print(r["source"]["id"])
Every engine returns the formula, the source, the data version and a deterministic receipt.
gc.pcaf(asset_class="listed_equity_corporate_bonds", holdings=[{
"outstanding_amount": 1_000_000,
"denominator": {"type": "evic", "value": 2_500_000_000_000},
"company_emissions": {"value": 20_000_000},
"data_quality_score": 2,
}])
gc.embodied(materials=[{
"material_key": "materials.concrete.ready_mix.c8_10",
"quantity": {"value": 50, "unit": "m3"},
"boundary": "A1-C",
}])
gc.freight(mass={"value": 1, "unit": "tonne"},
distance={"value": 100, "unit": "km"},
factor_key="freight.rail.tonne_km")
Also available: electricity, spend_based, business_travel, cii (IMO ship
CII rating), and
batch(items=[...]). Any methodology works via gc.calculate("<methodology>", **body).
Plain language to the right factor: gc.resolve("UK grid electricity").
Reproducibility
Pin any factor to a past data version so a figure reproduces exactly in an audit:
gc.factor("grid.gbr.electricity.location_based", as_of="2026.111")
Reading the archive needs a key. A keyless call with as_of raises rather than
returning a current value under a past label.
Errors
Errors name the next action, not an HTTP status.
from greencalculus import GreenCalculusError
try:
gc.factor("does.not.exist")
except GreenCalculusError as e:
print(e.status, e.code, e.message)
# 404 not_found No factor called "does.not.exist". Try search("does.not.exist").
Links
- Docs: https://greencalculus.com/developers/docs
- Data rights & continuity: https://greencalculus.com/developers/trust
- Request a factor / report a wrong value: https://github.com/greencalculus/greencalculus-sdk/issues
- MCP server (agents):
mcp.greencalculus.com
MIT licensed.
Metadata
Release files for greencalculus 0.3.0
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 | Actions |
|---|---|---|---|---|
| greencalculus-0.3.0.tar.gz | 8.5 kB | With provenance | Details for greencalculus-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| greencalculus-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for greencalculus-0.3.0-py3-none-any.whl |
Total release size: 16.2 kB
Release files / greencalculus-0.3.0.tar.gz
| Download URL | greencalculus-0.3.0.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fcbb747490ae143ea0769e8a4c101939aac9e873d13e6e3d54d48d5160f5375c
|
|
BLAKE2b-256 checksum How to use checksums |
45dd7f636e46af154cd27a93af05fb454f68121fb9726cbc972c9ef0143fdb22
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 31, 2026.
Transparency logRelease files / greencalculus-0.3.0-py3-none-any.whl
| Download URL | greencalculus-0.3.0-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e5f468cab1f318b3ae14bf75cec00acf2a561c6eea978f1df8b45ee7a3cae455
|
|
BLAKE2b-256 checksum How to use checksums |
171c8f591cf760db3dd7d2f2f06b341512dbf2eee2d949d0603a36f1ca51b1a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 31, 2026.
Transparency logSecurity for greencalculus 0.3.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for greencalculus-0.3.0.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 31, 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.