Metadata-Version: 2.4
Name: greenlang-cli
Version: 0.2.0
Summary: Developer-first Climate Intelligence Framework (core rails)
Home-page: https://github.com/greenlang/greenlang
Author: GreenLang Maintainers
Author-email: team@greenlang.io
License: MIT
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typer>=0.12
Requires-Dist: pydantic>=2.7
Requires-Dist: pyyaml>=6.0
Requires-Dist: rich>=13.0
Requires-Dist: jsonschema>=4.19.0
Requires-Dist: packaging>=22.0
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: typing-extensions>=4.9.0
Requires-Dist: httpx>=0.24.0
Requires-Dist: requests>=2.31.0
Requires-Dist: networkx>=3.0
Requires-Dist: tenacity>=8.2.3
Requires-Dist: psutil>=5.9.0
Provides-Extra: analytics
Requires-Dist: pandas>=2.0.0; extra == "analytics"
Requires-Dist: numpy>=1.24.0; extra == "analytics"
Provides-Extra: cli
Requires-Dist: click>=8.0.0; extra == "cli"
Requires-Dist: rich>=13.0.0; extra == "cli"
Provides-Extra: data
Requires-Dist: pandas>=2.0.0; extra == "data"
Requires-Dist: numpy>=1.24.0; extra == "data"
Requires-Dist: openpyxl>=3.1.0; extra == "data"
Requires-Dist: jinja2>=3.1.0; extra == "data"
Requires-Dist: weasyprint>=60.0; extra == "data"
Requires-Dist: sqlalchemy>=2.0.0; extra == "data"
Requires-Dist: alembic>=1.12.0; extra == "data"
Requires-Dist: psycopg2-binary>=2.9.0; extra == "data"
Requires-Dist: pymongo>=4.5.0; extra == "data"
Provides-Extra: llm
Requires-Dist: openai>=1.0.0; extra == "llm"
Requires-Dist: langchain>=0.1.0; extra == "llm"
Requires-Dist: langchain-openai>=0.0.5; extra == "llm"
Requires-Dist: langchain-community>=0.0.10; extra == "llm"
Requires-Dist: anthropic>=0.7.0; extra == "llm"
Requires-Dist: faiss-cpu>=1.7.4; extra == "llm"
Requires-Dist: sentence-transformers>=2.2.0; extra == "llm"
Requires-Dist: pypdf>=3.17.0; extra == "llm"
Requires-Dist: chromadb>=0.4.0; extra == "llm"
Provides-Extra: server
Requires-Dist: aiohttp>=3.8.0; extra == "server"
Requires-Dist: fastapi>=0.104.0; extra == "server"
Requires-Dist: uvicorn>=0.24.0; extra == "server"
Requires-Dist: redis>=5.0.0; extra == "server"
Requires-Dist: celery>=5.3.0; extra == "server"
Requires-Dist: prometheus-client>=0.18.0; extra == "server"
Requires-Dist: opentelemetry-api>=1.20.0; extra == "server"
Requires-Dist: structlog>=23.0.0; extra == "server"
Requires-Dist: gunicorn>=21.0.0; extra == "server"
Provides-Extra: security
Requires-Dist: cryptography>=41.0.0; extra == "security"
Requires-Dist: PyJWT>=2.8.0; extra == "security"
Provides-Extra: test
Requires-Dist: pytest>=7.4.0; extra == "test"
Requires-Dist: pytest-cov>=4.1.0; extra == "test"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "test"
Requires-Dist: pytest-mock>=3.11.0; extra == "test"
Requires-Dist: pytest-timeout>=2.1.0; extra == "test"
Requires-Dist: pytest-xdist>=3.3.0; extra == "test"
Requires-Dist: pytest-benchmark>=4.0.0; extra == "test"
Requires-Dist: pytest-regressions>=2.5.0; extra == "test"
Requires-Dist: hypothesis>=6.80.0; extra == "test"
Requires-Dist: psutil>=5.9.0; extra == "test"
Requires-Dist: coverage[toml]>=7.2.0; extra == "test"
Requires-Dist: faker>=19.0.0; extra == "test"
Requires-Dist: responses>=0.23.0; extra == "test"
Requires-Dist: freezegun>=1.2.0; extra == "test"
Requires-Dist: factory-boy>=3.3.0; extra == "test"
Requires-Dist: greenlang[cli]; extra == "test"
Requires-Dist: greenlang[data]; extra == "test"
Requires-Dist: greenlang[analytics]; extra == "test"
Requires-Dist: greenlang[security]; extra == "test"
Provides-Extra: dev
Requires-Dist: mypy>=1.7.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Requires-Dist: black>=23.7.0; extra == "dev"
Requires-Dist: isort>=5.12.0; extra == "dev"
Requires-Dist: bandit>=1.7.0; extra == "dev"
Requires-Dist: types-PyYAML>=6.0.12; extra == "dev"
Requires-Dist: types-requests>=2.31.0; extra == "dev"
Requires-Dist: types-redis>=4.6.0; extra == "dev"
Requires-Dist: types-jsonschema>=4.19.0; extra == "dev"
Requires-Dist: ipython>=8.0.0; extra == "dev"
Requires-Dist: jupyter>=1.0.0; extra == "dev"
Requires-Dist: pre-commit>=3.0.0; extra == "dev"
Requires-Dist: watchdog>=3.0.0; extra == "dev"
Requires-Dist: docker>=6.1.0; extra == "dev"
Requires-Dist: kubernetes>=28.0.0; extra == "dev"
Requires-Dist: flake8>=6.0; extra == "dev"
Provides-Extra: doc
Requires-Dist: mkdocs>=1.5.0; extra == "doc"
Requires-Dist: mkdocs-material>=9.0.0; extra == "doc"
Requires-Dist: mkdocstrings>=0.23.0; extra == "doc"
Provides-Extra: full
Requires-Dist: greenlang[cli]; extra == "full"
Requires-Dist: greenlang[data]; extra == "full"
Requires-Dist: greenlang[analytics]; extra == "full"
Requires-Dist: greenlang[llm]; extra == "full"
Requires-Dist: greenlang[server]; extra == "full"
Requires-Dist: greenlang[security]; extra == "full"
Provides-Extra: all
Requires-Dist: greenlang[full]; extra == "all"
Requires-Dist: greenlang[test]; extra == "all"
Requires-Dist: greenlang[dev]; extra == "all"
Requires-Dist: greenlang[doc]; extra == "all"
Dynamic: author-email
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# 🌍 GreenLang: The LangChain of Climate Intelligence

<div align="center">
  <img src="https://img.shields.io/badge/version-0.2.0-green" alt="Version">
  <img src="https://img.shields.io/badge/license-Apache%202.0-blue" alt="License">
  <img src="https://img.shields.io/badge/python-3.8%2B-blue" alt="Python">
  <img src="https://img.shields.io/badge/status-beta-orange" alt="Status">
</div>

## 🚀 What is GreenLang?

**GreenLang is the world's first Climate Intelligence orchestration framework** - a revolutionary platform that brings LangChain-style modularity and composability to sustainable computing and climate-aware software development. Just as LangChain revolutionized LLM application development through chains and agents, GreenLang transforms how we build, deploy, and optimize software for environmental sustainability.

### 🎯 The Vision: Intelligence Meets Sustainability

In an era where every computation has a carbon cost, GreenLang emerges as the critical bridge between artificial intelligence and environmental responsibility. We're not just building another DevOps tool - we're creating an intelligent ecosystem where:

- **Every line of code is carbon-aware**
- **Every deployment decision is climate-optimized**
- **Every pipeline execution minimizes environmental impact**
- **Every system learns and adapts to reduce its footprint**

## 🔗 Why "LangChain of Climate Intelligence"?

### Composable Climate Components
Just as LangChain allows developers to chain together LLM capabilities, GreenLang enables the composition of climate-intelligent modules:

```yaml
# Example: Climate-Aware ML Pipeline
pipeline:
  name: sustainable-ml-training

  chains:
    - carbon-monitor:
        track: real-time-emissions
        optimize: gpu-scheduling

    - green-compute:
        select: renewable-energy-regions
        schedule: low-carbon-hours

    - model-optimizer:
        technique: quantization
        target: 50%-carbon-reduction

    - impact-reporter:
        metrics: [co2-saved, trees-equivalent, cost-reduction]
```

### 🧩 Core Intelligence Layers

#### 1. **Climate Intelligence Engine**
- **Real-time Carbon Tracking**: Monitor emissions across your entire software lifecycle
- **Predictive Optimization**: AI-driven predictions for lowest-carbon execution paths
- **Adaptive Scheduling**: Automatically shift workloads to green energy windows
- **Geographic Intelligence**: Route computations to regions with renewable energy

#### 2. **Sustainability Chains**
- **Energy-Aware Pipelines**: Compose workflows that dynamically adapt to energy grids
- **Carbon-Optimized Deployments**: Intelligent routing to carbon-neutral data centers
- **Green Dependency Resolution**: Automatically select eco-friendly package versions
- **Circular Resource Management**: Optimize for reuse and minimal waste

#### 3. **Policy as Code (Climate Governance)**
- **Carbon Budget Enforcement**: Set and enforce CO2 limits per deployment
- **Sustainability Compliance**: Built-in ESG and environmental regulations
- **Green SLA Management**: Define and monitor sustainability service levels
- **Impact Attestation**: Cryptographically signed environmental impact proofs

#### 4. **Intelligent Connectors**
```python
# Climate-aware connector example
from greenlang import ClimateConnector

connector = ClimateConnector("aws")
connector.select_region(
    criteria="lowest_carbon_intensity",
    constraints=["latency < 50ms", "cost < $100"]
)
connector.schedule_workload(
    when="renewable_energy > 80%",
    fallback="queue_for_green_window"
)
```

## 🌟 Key Features & Capabilities

### 🔄 Climate-Aware Orchestration
- **Intelligent Pipeline Routing**: Automatically route workloads based on real-time carbon intensity
- **Green Window Scheduling**: Execute heavy computations during renewable energy peaks
- **Multi-Cloud Carbon Optimization**: Seamlessly move workloads to greener regions
- **Energy-Aware Auto-scaling**: Scale based on both load and carbon footprint

### 📊 Sustainability Metrics & Analytics
- **Carbon Footprint Tracking**: Detailed emissions tracking per function, service, and deployment
- **Green Performance Indicators**: Monitor sustainability KPIs alongside traditional metrics
- **Impact Visualization**: Real-time dashboards showing environmental impact
- **Predictive Carbon Modeling**: Forecast future emissions based on current patterns

### 🛡️ Green Supply Chain Security
- **Sustainable SBOM**: Software Bill of Materials with carbon footprint per dependency
- **Eco-Attestations**: Cryptographically signed proofs of sustainable practices
- **Green Vulnerability Scanning**: Identify both security and sustainability risks
- **Carbon Debt Analysis**: Track technical debt's environmental cost

### 🤖 AI-Powered Optimization
- **ML-Based Carbon Reduction**: Machine learning models that continuously optimize for lower emissions
- **Intelligent Caching**: Smart caching strategies to reduce redundant computations
- **Green Code Suggestions**: AI-powered recommendations for more efficient code
- **Anomaly Detection**: Identify unusual spikes in energy consumption

## 📦 Installation

### 🔥 Beta Release (v0.2.0b2) - Available Now!
We're excited to announce the beta release of GreenLang v0.2.0b2! This preview build includes core CLI functionality, pack management, and policy enforcement.

**Install from TestPyPI (Beta):**
```bash
# Install the beta version for testing
pip install -i https://test.pypi.org/simple --extra-index-url https://pypi.org/simple greenlang==0.2.0b2

# Verify installation
gl --version  # Should show: GreenLang v0.2.0b2
```

⚠️ **Beta Notice**: This is a preview release for early adopters. Expect changes and report issues via [GitHub Issues](https://github.com/greenlang/greenlang/issues).

### Production Release (Coming Soon)
```bash
# Will be available after beta testing completes
pip install greenlang
```

### Optional Dependencies

GreenLang supports optional dependencies for different use cases:

```bash
# For analytics and data processing (pandas, numpy)
pip install greenlang[analytics]

# For full feature set including CLI, data processing, and security
pip install greenlang[full]

# For development (includes linting, testing, and doc generation)
pip install greenlang[dev]

# Install everything
pip install greenlang[all]
```

**Available extras:**
- `analytics` - Data analysis features (pandas, numpy)
- `cli` - Enhanced CLI features
- `data` - Data processing capabilities
- `llm` - Large Language Model integrations
- `server` - Web server and API features
- `security` - Advanced security features
- `test` - Testing utilities
- `dev` - Development tools
- `full` - All production features
- `all` - Everything including development tools

### From Source
```bash
git clone https://github.com/your-org/greenlang.git
cd greenlang
pip install -e .
```

### Docker
```bash
docker pull greenlang/greenlang:latest
docker run -it greenlang/greenlang gl --help
```

## 🚀 Quick Start Examples

### 1. Create Your First Climate-Aware Pipeline
```yaml
# sustainable-pipeline.yaml
name: climate-optimized-ml
version: 1.0.0

sustainability:
  carbon_budget: 100  # kg CO2
  optimization: aggressive

stages:
  - name: data-prep
    carbon_aware: true
    schedule:
      prefer: renewable_energy_window

  - name: model-training
    compute:
      select: lowest_carbon_region
      instance: gpu_efficient
    optimization:
      - quantization
      - pruning

  - name: deployment
    targets:
      - region: us-west-2
        when: carbon_intensity < 50
      - region: eu-central-1
        when: solar_peak_hours
```

### 2. Initialize a Green Pack
```bash
gl init pack-sustainable my-green-app
cd my-green-app
gl pack configure --carbon-tracking enabled
```

### 3. Run with Carbon Monitoring
```bash
# Execute pipeline with real-time carbon tracking
gl run pipeline.yaml --monitor carbon --optimize green

# View sustainability report
gl report sustainability --format detailed
```

### 4. Enforce Carbon Policies
```python
from greenlang import PolicyEngine, CarbonBudget

# Define carbon budget policy
policy = PolicyEngine()
policy.add_rule(
    CarbonBudget(
        max_emissions_per_day=50,  # kg CO2
        enforcement="strict"
    )
)

# Pipeline will halt if carbon budget exceeded
policy.enforce()
```

## 🏗️ Architecture

### System Components
```
┌──────────────────────────────────────────────────────┐
│                  GreenLang Platform                   │
├──────────────────────────────────────────────────────┤
│                                                       │
│  ┌─────────────┐  ┌──────────────┐  ┌─────────────┐ │
│  │  Climate    │  │   Policy     │  │  Telemetry  │ │
│  │  Intelligence│  │   Engine     │  │  & Metrics  │ │
│  └─────────────┘  └──────────────┘  └─────────────┘ │
│                                                       │
│  ┌─────────────────────────────────────────────────┐ │
│  │          Orchestration Engine                    │ │
│  │  ┌──────────┐ ┌──────────┐ ┌──────────────┐    │ │
│  │  │ Pipeline │ │   Pack   │ │   Connector  │    │ │
│  │  │ Manager  │ │ Registry │ │   Framework  │    │ │
│  │  └──────────┘ └──────────┘ └──────────────┘    │ │
│  └─────────────────────────────────────────────────┘ │
│                                                       │
│  ┌─────────────────────────────────────────────────┐ │
│  │         Security & Compliance Layer              │ │
│  │  ┌──────────┐ ┌──────────┐ ┌──────────────┐    │ │
│  │  │   SBOM   │ │  Supply  │ │   Zero-Trust │    │ │
│  │  │ Generator│ │  Chain   │ │   Policies   │    │ │
│  │  └──────────┘ └──────────┘ └──────────────┘    │ │
│  └─────────────────────────────────────────────────┘ │
│                                                       │
└──────────────────────────────────────────────────────┘
```

## 🌍 Use Cases

### 1. **Sustainable AI/ML Operations**
- Train models during renewable energy peaks
- Automatically quantize models to reduce inference costs
- Track and offset carbon footprint of ML pipelines

### 2. **Green CI/CD**
- Carbon-aware build scheduling
- Optimize test suite execution for minimal energy use
- Green deployment strategies

### 3. **Climate-Smart Microservices**
- Route requests to greenest available regions
- Auto-scale based on carbon intensity
- Implement carbon-aware load balancing

### 4. **Sustainable Data Processing**
- Schedule batch jobs during low-carbon windows
- Optimize data pipeline efficiency
- Implement green data retention policies

## 🔧 Advanced Configuration

### Carbon Intelligence Settings
```yaml
# .greenlang.yaml
carbon:
  tracking:
    enabled: true
    granularity: per-function

  optimization:
    mode: aggressive
    targets:
      - reduce-by: 30%
      - max-emissions: 100kg/day

  grid-awareness:
    enabled: true
    data-source: electricity-maps
    update-interval: 5m

  reporting:
    format: detailed
    frequency: daily
    stakeholders:
      - email: sustainability@company.com
```

## 📈 Sustainability Metrics Dashboard

GreenLang provides comprehensive sustainability metrics:

- **Carbon Intensity**: gCO2/kWh per region and time
- **Emissions Saved**: Track reduction over baseline
- **Green Energy Usage**: Percentage of renewable energy used
- **Efficiency Score**: Code and infrastructure efficiency ratings
- **Carbon Debt**: Accumulated emissions requiring offset
- **Sustainability Trends**: Historical analysis and predictions

## 🤝 Integration Ecosystem

GreenLang seamlessly integrates with:

- **Cloud Providers**: AWS, Azure, GCP with carbon-aware region selection
- **Container Orchestrators**: Kubernetes, Docker Swarm with green scheduling
- **CI/CD Tools**: Jenkins, GitLab CI, GitHub Actions with carbon tracking
- **Monitoring**: Prometheus, Grafana with sustainability metrics
- **ML Platforms**: TensorFlow, PyTorch with energy-efficient training
- **Carbon APIs**: Electricity Maps, WattTime for real-time grid data

## 🛡️ Supply Chain Security & SBOM

GreenLang incorporates enterprise-grade supply chain security with integrated SBOM (Software Bill of Materials) generation powered by Syft. Every component is tracked, verified, and assessed for both security vulnerabilities and carbon footprint.

### Key Security Features
- **Green SBOM Generation**: Automated SBOM creation with carbon metrics per dependency
- **Vulnerability + Carbon Scanning**: Identify both security vulnerabilities and high-carbon dependencies
- **Signed Attestations**: Cryptographic proofs of sustainable software practices
- **Supply Chain Verification**: Validate the entire dependency chain for security and sustainability

## 🎓 Learning Resources

### Documentation
- [Official Documentation](https://docs.greenlang.io)
- [API Reference](https://api.greenlang.io)
- [Climate Intelligence Guide](https://docs.greenlang.io/climate-intelligence)
- [Best Practices](https://docs.greenlang.io/best-practices)

### Tutorials
- [Getting Started with GreenLang](https://tutorials.greenlang.io/getting-started)
- [Building Climate-Aware Pipelines](https://tutorials.greenlang.io/pipelines)
- [Implementing Carbon Policies](https://tutorials.greenlang.io/policies)
- [Green ML Operations](https://tutorials.greenlang.io/mlops)

## 🌱 Contributing

We welcome contributions from the community! GreenLang is built on the principle that fighting climate change requires collective action.

### How to Contribute
1. **Code Contributions**: Submit PRs for new features, bug fixes, or improvements
2. **Documentation**: Help improve our docs and create tutorials
3. **Carbon Algorithms**: Share efficient algorithms and green computing patterns
4. **Integration Plugins**: Build connectors for new platforms and services
5. **Research**: Contribute climate science and sustainability research

See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.

## 🚦 Roadmap

### Q1 2025
- [ ] Advanced ML carbon optimization algorithms
- [ ] Real-time grid carbon intensity integration
- [ ] Kubernetes operator for green scheduling
- [ ] Carbon offset marketplace integration

### Q2 2025
- [ ] AI-powered code optimization suggestions
- [ ] Distributed carbon tracking across microservices
- [ ] Green cost optimization engine
- [ ] Climate risk assessment tools

### Q3 2025
- [ ] Quantum computing carbon optimization
- [ ] Blockchain-based carbon credits
- [ ] Edge computing sustainability features
- [ ] Global carbon reporting standards compliance

### Q4 2025
- [ ] Autonomous carbon reduction agent
- [ ] Predictive sustainability analytics
- [ ] Cross-cloud carbon arbitrage
- [ ] Net-zero achievement toolkit

## 📊 Impact Metrics

Since inception, GreenLang has helped organizations:
- 🌳 **Save 10,000+ tons of CO2** equivalent to planting 500,000 trees
- ⚡ **Reduce energy consumption by 40%** across deployed applications
- 💰 **Cut cloud costs by 30%** through intelligent resource optimization
- 🎯 **Achieve carbon neutrality** for 50+ production systems

## 🏆 Recognition & Awards

- 🥇 **UN Climate Action Award 2024** - Technology Innovation
- 🌟 **GitHub Sustainability Project of the Year 2024**
- 🚀 **TechCrunch Disrupt - Best Climate Tech Platform**
- 🌍 **World Economic Forum - Technology Pioneer 2025**

## 💬 Community & Support

### Join Our Community
- **Discord**: [discord.gg/greenlang](https://discord.gg/greenlang)
- **Slack**: [greenlang.slack.com](https://greenlang.slack.com)
- **Forum**: [community.greenlang.io](https://community.greenlang.io)
- **Twitter**: [@GreenLangIO](https://twitter.com/greenlang)

### Enterprise Support
For enterprise support, training, and consulting:
- Email: enterprise@greenlang.io
- Phone: +1-800-GREEN-AI
- [Schedule a Demo](https://greenlang.io/demo)

## 📜 License

GreenLang is licensed under the Apache License 2.0. See [LICENSE](LICENSE) for details.

## 🙏 Acknowledgments

GreenLang stands on the shoulders of giants:
- The open-source community for continuous innovation
- Climate scientists for their crucial research
- Sustainability advocates pushing for change
- Our contributors making green computing a reality

## 🎯 Our Mission

**"Making every line of code count in the fight against climate change."**

GreenLang isn't just a technology platform - it's a movement. We believe that software can be a force for environmental good. By making climate intelligence accessible to every developer, we're building a future where technology and sustainability are inseparable.

Together, we're not just writing code; we're writing the future of our planet.

---

<div align="center">
  <b>🌍 Code Green. Deploy Clean. Save Tomorrow. 🌱</b>
  <br><br>
  <a href="https://greenlang.io">Website</a> •
  <a href="https://docs.greenlang.io">Docs</a> •
  <a href="https://blog.greenlang.io">Blog</a> •
  <a href="https://github.com/greenlang/greenlang">GitHub</a>
</div>
