EcoTrace Carbon Gate
Version updated for https://github.com/Zwony/ecotrace to version v1.2.0.
- This action is used across all versions by 0 repositories.
Action Type
This is a Composite action.
Go to the GitHub Marketplace to find the latest changes.
Action Summary
EcoTrace is a Python library designed to provide real-time, hardware-level monitoring of energy consumption and carbon emissions for Python applications, with a focus on precision and ease of use. It automates the measurement and reporting of carbon footprints, particularly for machine learning workflows, by offering features like continuous sampling, function-level tracking, and regional carbon intensity analysis without requiring complex configurations. Key capabilities include high-frequency hardware monitoring, AI-specific tracking tools, zero-code profiling, and automated report generation for audit-ready insights.
What’s Changed
Release Notes — v1.2.0
Released: 2026-05-31 Type: Feature Release — ML/AI Tracking, Windows NVML Compatibility & Stability Fixes
Summary
v1.2.0 introduces the brand-new EcoTraceML tracking engine specifically designed for measuring the energy consumption and carbon footprint of machine learning and AI model training sessions. It also delivers critical compatibility fixes for NVIDIA NVML on Windows, lazy-loads optional AI dependencies, and fixes Pylance type warnings.
Key Features
1. Dedicated Machine Learning Tracker (EcoTraceML)
Introducing EcoTraceML (available as a context manager and the @ecotrace_ml decorator) to measure CPU, GPU, and RAM energy consumption during ML training runs with millisecond precision:
- Asynchronous Sampling: A background thread polls hardware utilization and power usage continuously.
- Automatic Summary Reports: Generates standard Markdown summaries and detailed PDF/CSV reports.
- Parameters Supported: Configurable metrics such as epoch size, batch size, and dataset size.
from ecotrace import EcoTraceML
with EcoTraceML(project_name="ImageClassifier", epochs=10, batch_size=32) as tracker:
# Your model training loop here
pass
2. Enhanced NVIDIA NVML Windows Compatibility
- DLL Path Injection: The GPU utility now dynamically searches for
nvml.dllwithinProgram Files\NVIDIA Corporation\NVSMIandSystem32and appends it to the PATH, resolving import issues on Windows. - Driver Decode Fix: Safe fallback UTF-8 decoding for newer NVIDIA driver queries returning binary GPU names.
3. FPDF & Pylance Type Safety
- Modified PDF reporting methods to use positional arguments for cell text instead of the
txtkeyword argument, preventing runtime type warnings and strict Pylance checking errors.
4. Lazy-loading AI Extensions
- Lazy-loaded
google-generativeaiinside its specific invocation scope. This preventsModuleNotFoundErrorwhen importingecotraceon environments where the[ai]optional dependency extra is not installed.
5. Verified & Tested
- Added
example_ml.pyfor illustrating the new ML training telemetry. - Added comprehensive unit tests under
tests/test_ml.py.
Installation
pip install ecotrace==1.2.0
I would like to thank @batuhanyilmaz1 for his interest, help, and for leading the release of this version