Skip to main content
EcoTrace Logo

EcoTrace

High-Precision Energy and Emissions Instrumentation


v1.5.0 — Hosted Cloud Integration & Real-Time Observatory. Native CloudExporter, terminal authentication (ecotrace login), 6,980+ CPU TDP database, Python 3.14+ readiness, WebSocket live streaming, and session run filtering.

EcoTrace is a lightweight library for granular carbon footprint measurement of Python applications. No configuration files, no background services—just real-time hardware-level transparency.

Real-time monitoring | 50+ Global Zones | AI-powered insights | Zero-configuration


Official Website PyPI - Version Python 3.8+ License: MIT Downloads Join Discord VS Code Extension


[!TIP] 🌐 Live Web Observatory: Stream and monitor your application carbon footprint in real-time on our hosted web platform at ecotracelibrary.com.

[!TIP] VS Code Extension: Monitor application carbon footprint in real-time during development. Download here.


EcoTrace Demo

Function-level carbon measurement with real-time monitoring


Core Features in v1.5.0

Major Release. v1.5.0 introduces direct cloud telemetry streaming to ecotracelibrary.com, terminal authentication (ecotrace login), 6,980+ CPU TDP database coverage, Python 3.14+ compatibility, and WebSocket live streaming.

  • 🌐 Hosted Cloud Observatory (CloudExporter) — Stream carbon metrics directly to your private web dashboard on ecotracelibrary.com using EcoTrace(api_key="eco_usr_...").
  • 🔑 CLI Credential Management (ecotrace login) — Authenticate your terminal once via ecotrace login --key eco_usr_... so all ecotrace run profiling runs automatically stream to your web dashboard.
  • 6,980+ CPU TDP Database (%100 TDP Validity) — Expanded dataset from 1,806 to 6,983 unique CPU models, including +760% mobile/laptop CPU coverage (Intel 10th-14th Gen, Core Ultra, AMD Ryzen, Apple Silicon M1-M4).
  • 🐍 Python 3.8 → 3.14+ Compatibility — Fully verified runtime compatibility across Python 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, and 3.14+.
  • WebSocket Real-Time Streaming — Instant live metric updates on your web dashboard via /api/ws/live.
  • 🏷️ Session Run Filtering — Filter web dashboard metrics by specific run_id / run_label execution sessions.
  • ⏸️ Pausing API — Temporarily disable carbon tracking using EcoTrace.pause() and EcoTrace.resume().
  • 📊 Run Comparisons (ecotrace diff) — Perform side-by-side carbon and duration comparisons between runs.

Quick Install

pip install ecotrace

Optional extras:

pip install ecotrace[gpu]   # NVIDIA GPU support
pip install ecotrace[ai]    # Gemini AI insights
pip install ecotrace[all]   # Everything

Quick Start

Option 1: Zero-Code Profiling (CLI + Cloud Sync)

Authenticate your terminal once, then profile any script without changing source code:

# 1. Login with your ingestion key from https://ecotracelibrary.com
ecotrace login --key eco_usr_abc123...

# 2. Run your script — metrics automatically stream to your web dashboard!
ecotrace run my_script.py

Option 2: Programmatic Tracking & Cloud Dashboard

Decorate functions for granular instrumentation and stream metrics to your web account:

from ecotrace import EcoTrace

# Connects directly to your hosted account at https://ecotracelibrary.com
eco = EcoTrace(api_key="eco_usr_abc123...", region_code="US")

@eco.track
def my_function():
    # Your heavy processing here
    pass

my_function()

# Export audit-ready reports or check cumulative totals
eco.generate_pdf_report("carbon_audit.pdf")
print(f"Total Carbon Emitted: {eco.total_carbon} gCO2")

Option 3: Carbon Budget Mode

Set a limit and let EcoTrace enforce it:

eco = EcoTrace(
    region_code="TR",
    carbon_limit=5.0,                   # 5 gCO2 budget
    on_budget_exceeded=lambda t, l: print(f"Budget exceeded: {t:.4f}/{l:.4f} gCO2")
)

@eco.track
def training_pipeline():
    ...

training_pipeline()
print(f"Remaining budget: {eco.remaining_budget} gCO2")

Expected Output

When initialized, EcoTrace performs automated hardware detection:

[EcoTrace] INFO: [INFO] EcoTrace instrumentation session initialized (STATIC).
[EcoTrace] INFO: -----------------------------------------------------
[EcoTrace] INFO: Region        : TR (475 gCO2/kWh)
[EcoTrace] INFO: Hardware Logic: 13th Gen Intel Core i7-13700H
[EcoTrace] INFO: Specifications: 20 Cores | 45.0W TDP
[EcoTrace] INFO: Energy Sensor : Boavizta Advanced Estimation
[EcoTrace] INFO: Memory Config : 15.6 GB DDR4
[EcoTrace] INFO: GPU Accelerator: Intel Iris Xe Graphics (15.0W TDP)
[EcoTrace] INFO: -----------------------------------------------------

At process exit, a session summary is printed automatically:

=======================================================
  EcoTrace — Session Summary
=======================================================
  Duration       : 12.34s
  Functions      : 5 tracked
  Total Carbon   : 0.00312000 gCO2
  Region         : TR (475 gCO2/kWh)
  Budget         : 0.003120 / 5.000000 gCO2 (0.1%) [OK]
  Equivalent     : 0.4 min of LED bulb (10W)
=======================================================

CI/CD Integration

Official GitHub Action

Enforce carbon budgets in your pipeline with our official GitHub Action. Add this to your .github/workflows/ci.yml:

- name: EcoTrace Carbon Gate
  uses: Zwony/ecotrace@v1.5.0
  with:
    budget: '10.0'
    region: 'US'

Manual CLI Integration

You can also run the gate manually:

ecotrace gate --budget 10.0

If total emissions exceed the budget, the gate fails with exit code 1 — preventing carbon-heavy code from being merged.


Why EcoTrace?

Feature EcoTrace v1.5 CodeCarbon CarbonTracker
Sampling Interval 50ms 15s Per Epoch
Isolation Process-scoped System-wide System-wide
Cloud Dashboard Sync Native No No
CPU Dataset 6,980+ CPUs Limited Limited
Budget Enforcement Built-in No No
CI/CD Gate Built-in No No
Idle Noise Subtraction Automatic No No
Async Support Native Limited No
  • Deep Transparency: Derived from 6,980+ verified manufacturer TDP specifications rather than category averages.
  • Fail-Safe Architecture: Guaranteed application continuity even if hardware drivers or API keys are missing.
  • Actionable AI: Integrates with Google Gemini to provide specific code optimization advice (optional).

Documentation

Full documentation is available at ecotracelibrary.com and ecotrace.readthedocs.io.


Contributing

We welcome contributions! Please see our CONTRIBUTING.MD for guidelines on reporting bugs, suggesting features, or contributing hardware data.


Community

Join Discord

CHANGELOG.md · SECURITY.MD


Author and License

Emre OzkalGitHub · ecotraceteam@gmail.com

MIT License — Use it however you like.

Developed for sustainable software development practices.

Download files

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

Source Distribution

ecotrace-1.5.1.tar.gz (163.3 kB view details)

Uploaded Source

Built Distribution

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

ecotrace-1.5.1-py3-none-any.whl (159.3 kB view details)

Uploaded Python 3

File details

Details for the file ecotrace-1.5.1.tar.gz.

File metadata

  • Download URL: ecotrace-1.5.1.tar.gz
  • Upload date:
  • Size: 163.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.1

File hashes

Hashes for ecotrace-1.5.1.tar.gz
Algorithm Hash digest
SHA256 5287b097d0952161a4b2f314aea4e4fb7afa9910f3ccce9f2de59009c0175915
MD5 5e075ad5d2239210bcb1cd09d0f1de23
BLAKE2b-256 bb3e0dbebfb5d22515c2d198bdff4976aabdddd7faf1b82fc9f761312f1af303

See more details on using hashes here.

File details

Details for the file ecotrace-1.5.1-py3-none-any.whl.

File metadata

  • Download URL: ecotrace-1.5.1-py3-none-any.whl
  • Upload date:
  • Size: 159.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.1

File hashes

Hashes for ecotrace-1.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 44ba591015e45c376cea72f58955284cd45504a04c73b4607453789e457230b1
MD5 baa2978b88d64400bfad0ac6d455e711
BLAKE2b-256 343fdf49f16e1f56c0dd242b1f1c24b5ed749220e380306c55d13cf0a2245c64

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.5.1 This release

2 files

1.5.0

2 files

1.4.3

2 files

1.4.2

2 files

1.4.1

2 files

1.4.0

2 files

1.3.0

2 files

1.2.1

2 files

1.2.0

2 files

1.1.2

2 files

1.1.0

2 files

1.0.1

2 files

0.9.0

2 files

0.8.0

2 files

0.7.1

2 files

0.7.0

2 files

0.6.1

2 files

0.6.0

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.0

2 files

0.3.5

2 files

0.3.4

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.0

1 file

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