greenfootprint is a lightweight Python tool that estimates the energy consumption and carbon footprint of any Python script. It helps developers measure the environmental impact of their code in terms of runtime, CPU usage, energy, and CO₂ emissions.
Author – thuve-codes – LinkedIn
- 🔍 Analyze energy and carbon usage of a Python script
- ⚙️ Uses runtime and CPU time to estimate watt-hours
- 🌫️ Converts energy usage to estimated CO₂ grams
- 📊 Simple CLI with clean output
- 🧠 Tips to improve efficiency (coming soon)
pip install greenfootprint
greenfootprint examples\example_script.py
🔍 Running analysis on: examples/example_script.py
📊 Analysis Report for examples/example_script.py ⏱️ Runtime: 2.37 seconds 🧠 CPU Time: 2.10 seconds 🔋 Energy Used: 0.0088 kWh 🌫️ CO₂ Emitted: 4.16 grams
✅ Your code is moderately green!