Installation¶
Requirements¶
- Python 3.11 or higher
- pip package manager
Installation Options¶
SDK Only¶
For integrating carbon-awareness into your Python applications:
CLI Tool¶
For terminal usage and carbon checks:
The CLI automatically includes the SDK as a dependency.
Development Installation¶
For contributing to CarbonCue:
# Clone the repository
git clone https://github.com/CyrilBaah/carboncue.git
cd carboncue
# Install with development dependencies
pip install -e ".[dev,docs]"
# Install pre-commit hooks
pre-commit install
GitHub Action¶
No installation required! Simply reference the action in your workflow:
Verify Installation¶
SDK¶
CLI¶
Configuration¶
API Key Requirement¶
CarbonCue has different requirements depending on which features you use:
- ✅ No API key needed for SCI calculations (
calculate_sci()) - ✅ No API key needed for region mapping utilities
- ⚠️ API key required for real-time carbon intensity data (
get_current_intensity())
Get an API Key¶
- Visit Electricity Maps
- Sign up for a free or paid account
- Generate an API key from your dashboard
Set Environment Variable¶
For GitHub Actions¶
Add the API key as a repository secret:
- Go to your repository Settings → Secrets and variables → Actions
- Click "New repository secret"
- Name:
ELECTRICITY_MAPS_API_KEY - Value: Your API key
- Use in workflow:
- uses: CyrilBaah/carboncue@v1.0.0
env:
CARBONCUE_ELECTRICITY_MAPS_API_KEY: ${{ secrets.ELECTRICITY_MAPS_API_KEY }}