Skip to main content

Terminal interface for carbon-aware development

Project description

CarbonCue CLI

Terminal interface for carbon-aware development.

Installation

pip install carboncue-cli

Commands

Check Carbon Intensity

Get current carbon intensity for a cloud region:

# AWS US West 2
carboncue check --region us-west-2 --provider aws

# Azure West Europe
carboncue check --region westeurope --provider azure

# Short form
carboncue check -r us-east-1 -p aws

Calculate SCI Score

Calculate Software Carbon Intensity (SCI) score:

carboncue sci \
  --operations 100 \
  --materials 50 \
  --functional-unit 1000 \
  --unit-type requests \
  --region us-west-2

# Short form
carboncue sci -o 100 -m 50 -r 1000 -t requests

Parameters:

  • --operations, -o: Operational emissions in gCO2eq (energy usage)
  • --materials, -m: Embodied emissions in gCO2eq (hardware)
  • --functional-unit, -r: Number of functional units
  • --unit-type, -t: Type of functional unit (requests, users, transactions, etc.)
  • --region: Cloud region (default: us-west-2)
  • --provider, -p: Cloud provider (aws, azure, gcp, etc.)

View Configuration

carboncue config

Configuration

Set environment variables:

export CARBONCUE_ELECTRICITY_MAPS_API_KEY=your_api_key
export CARBONCUE_DEFAULT_REGION=us-west-2
export CARBONCUE_DEFAULT_CLOUD_PROVIDER=aws

Or create a .env file in your project:

CARBONCUE_ELECTRICITY_MAPS_API_KEY=your_api_key
CARBONCUE_DEFAULT_REGION=us-west-2

Examples

CI/CD Integration

# Check if carbon intensity is low before running expensive tests
INTENSITY=$(carboncue check -r us-west-2 -p aws --json | jq '.carbon_intensity')
if [ $INTENSITY -lt 200 ]; then
  echo "Low carbon intensity - running full test suite"
  pytest
else
  echo "High carbon intensity - deferring non-critical tests"
  pytest -m critical
fi

Monitoring Scripts

#!/bin/bash
# monitor-carbon.sh - Check carbon intensity every hour

while true; do
  carboncue check -r us-west-2 -p aws
  sleep 3600
done

Output Formats

All commands support rich terminal output with colors and tables for better readability.

License

MIT License - see LICENSE file for details.

Project details


Download files

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

Source Distribution

carboncue_cli-1.1.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

carboncue_cli-1.1.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file carboncue_cli-1.1.0.tar.gz.

File metadata

  • Download URL: carboncue_cli-1.1.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for carboncue_cli-1.1.0.tar.gz
Algorithm Hash digest
SHA256 f6e9de40b2893107cb2b85e402b5082468957d7530ad6e3b3f235b5f026d20ee
MD5 a2cca0e5bf38496b2dc3ec9238b7d6bf
BLAKE2b-256 7ec959bd12a5ce0736ede692cf23820ebb2be9cf7f004ad30f754818a58dd381

See more details on using hashes here.

File details

Details for the file carboncue_cli-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: carboncue_cli-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for carboncue_cli-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2de3665a7c144455e22d7ec0c460f26e4e1b2a66072d92fb98a073874015ffda
MD5 dab429b16adf662afeac53c57f9011b3
BLAKE2b-256 5fa581955e8220d3302e7c263b50576c8c3d320f427967c6999e737ac6ea754b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page