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 per GSF specification:

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.0.0.tar.gz (4.1 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.0.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: carboncue_cli-1.0.0.tar.gz
  • Upload date:
  • Size: 4.1 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.0.0.tar.gz
Algorithm Hash digest
SHA256 bd012a6e4542d2cc9af9b5cc9e8e7ab28724a4ea6ce6d069be09a91b27c9dddb
MD5 27cb062ad4292d5786ce3630ef4fff1e
BLAKE2b-256 dcc6e3ba595cba128c427dd613269fec6aa9b40de939c4c0991dd512988505c2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: carboncue_cli-1.0.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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb3a9960fe0c82a82880edccdd7e4aef2d6cbcf483e48c9561e0206ef259c48e
MD5 342005142d458f2ff45817cf7ab2393a
BLAKE2b-256 1a67dd37e33b06c416eca443888d12039ed21f5cc0339e78465a58f46c49c6b6

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