EcoTrace: High-precision carbon tracking engine for production Python. Function-level CPU/GPU emission measurement with 50ms continuous sampling, Boavizta TDP database, and audit-ready PDF reporting.
Project description
EcoTrace
High-Precision Energy and Emissions Instrumentation
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
[!TIP] VS Code Extension: Monitor application carbon footprint in real-time during development. Download here.
Function-level carbon measurement with real-time monitoring
Quick Install
pip install ecotrace
Quick Start
Option 1: Zero-Code Profiling (CLI)
Measure any script without changing a single line of code:
ecotrace run my_script.py
Option 2: Programmatic Tracking (Library)
Decorate functions for granular instrumentation:
from ecotrace import EcoTrace
# region_code: Use ISO 3166-1 alpha-2 (e.g., US, TR, DE). See docs/SUPPORT.md for full list.
eco = EcoTrace(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")
Expected Output
When initialized, EcoTrace performs automated hardware detection:
---------------------------------
--- EcoTrace v0.8.0 Initialized ---
Region : US (367 gCO2/kWh)
CPU : 13th Gen Intel Core i9-13900K
TDP : 125.0W
Monitoring: Active (50ms sampling)
---------------------------------
Why EcoTrace?
| Feature | EcoTrace | CodeCarbon | CarbonTracker |
|---|---|---|---|
| Sampling Interval | 50ms | 15s | Per Epoch |
| Isolation | Process-scoped | System-wide | System-wide |
| Dependencies | Zero (Core) | 10+ (Pandas, etc.) | 5+ |
| Async Support | Native | Limited | No |
- Deep Transparency: Derived from 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
- Architecture and Science — How the energy model and process isolation work.
- Advanced Usage — GPU tracking, AI insights, benchmarks, and comparison tables.
- Support and Reference — Troubleshooting, region codes, and hardware compatibility.
Contributing
We welcome contributions! Please see our CONTRIBUTING.MD for guidelines on reporting bugs, suggesting features, or contributing hardware data.
Community
Author and License
Emre Ozkal — GitHub · ecotraceteam@gmail.com
MIT License — Use it however you like.
Developed for sustainable software development practices.
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 ecotrace-0.8.0.tar.gz.
File metadata
- Download URL: ecotrace-0.8.0.tar.gz
- Upload date:
- Size: 405.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0782e57ee391bb9817bd1c48bab21ffe1a55bbf4d793498601a8aa7256fc554a
|
|
| MD5 |
31c38c295f5ca7454bdfdc1ae1769d18
|
|
| BLAKE2b-256 |
e4a33a7c71c49cef4dba5f56c8b3ed3b896b88e7e9d4ff6787969159cc257796
|
File details
Details for the file ecotrace-0.8.0-py3-none-any.whl.
File metadata
- Download URL: ecotrace-0.8.0-py3-none-any.whl
- Upload date:
- Size: 422.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1960583b4a1c942c8b764793b390bbb8aae9ab253003c03d47b1d393fc0d13cd
|
|
| MD5 |
68d02b0c3c32bc58075a3adfcfaacac9
|
|
| BLAKE2b-256 |
ec5d11bc991e43ca2b4a678f7300794d19b6d5c5549d3d690395502042f8f859
|