Skip to main content

greencalculus

The official Python client for the GreenCalculus API — sourced greenhouse-gas emission factors and audit-traced calculations. Every value comes back with its source cell and data version, so you hand back citable numbers, not guesses.

Zero third-party dependencies (standard library only).

Install

pip install greencalculus

Quickstart

Get a free API key (1,000 calls/month, no card) at greencalculus.com/developers.

from greencalculus import GreenCalculus

gc = GreenCalculus(api_key="gc_live_...")

# A sourced emission factor. value & unit are at the top level for convenience;
# the full sourced row (source cell, gas, GWP set) stays under ["factor"].
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

# An audit-traced calculation — the full working, not just a total
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"])                            # e.g. EMBER_YEARLY_ELECTRICITY_2025

# Plain language -> the right factor, with a confidence score
m = gc.resolve("UK grid electricity")

Calculations

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, and batch(calculations=[...]). Any methodology works via gc.calculate("<methodology>", **body).

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

Errors

from greencalculus import GreenCalculusError

try:
    gc.factor("does.not.exist")
except GreenCalculusError as e:
    print(e.status, e.code, e.message)

Links

MIT licensed.

Download files

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

Source Distribution

greencalculus-0.1.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

greencalculus-0.1.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file greencalculus-0.1.0.tar.gz.

File metadata

  • Download URL: greencalculus-0.1.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for greencalculus-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9240a845d128b205de792fa96b49934a165ec7d015b7b28e71ffa75638a64f9e
MD5 4733ba447c3dc72743289ed18a8d959f
BLAKE2b-256 b4e8c06360c6f7a81409e0fd42221b02098c9af1ec5686c4e6025b8ed7466d2d

See more details on using hashes here.

File details

Details for the file greencalculus-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: greencalculus-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for greencalculus-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f144032d96c248fbe0a18530d34a9a1779d93e824a04c6040790028ef5fc16dc
MD5 7621914d16d274f9675bfc0f8efb2bdb
BLAKE2b-256 83bea4f6850ba7527e435b26c924ce15db3a3a8f5123c8cec6b1562ee6680985

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

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