Skip to main content

A JupyterLab extension for workflow sustainability metrics.

Project description

๐ŸŒฑ๐ŸŒโ™ป๏ธ EcoJupyter (a GreenDIGIT project)

EcoJupyter is an platform-agnostic sustainability assessment tool for AI infrastructures. The current version is focused on Jupyter Notebook.

This tool was developed for the GreenDIGIT EU Project, with the main goal of providing a platform agnostic and easily-pluggable sustainability and reproducibility tool.

Main features

  • Read energy metrics through Prometheus and Scaphandre in real-time charts.
  • Energy computed KPIs such as SCI, SCI/Unit and Energy/Unit.
  • Metadata manager and exporter for Federated Data Management Infrastructures (FDMI).

It works best with JupyterK8sMonitor infrastructure configuration and scripts. For more info please contact the main contributor.

EcoJupyter_main_app

Installation

In order to install the tool as an extension in Jupyter Notebook or Lab (not in development), simply install the tool in your Python environment where Jupyter is running.

pip install --upgrade ecojupyter

Development & Extension Framework

This repository was initially scaffolded using the official JupyterLab Extension Tutorial.
As a result, the extension supports a development mode with live reloading, allowing for real-time updates to the UI as you modify TypeScript/React components.

To launch the development environment (as per the tutorial), run:

./scripts/start-jupyterlab-dev.sh

This will start JupyterLab in development mode, ideal for iterating on the UI and debugging extension logic interactively.

Python Package & Deployment The Python package is published on PyPI and can be built locally via:

./scripts/build-rel-package.sh

This script automatically packages the extension and prepares it for upload, enabling a simple and consistent release workflow.

Future Improvements

  • Version-based deployment: easily extendable via GitHub releases or semantic versioning.
  • CI/CD integration: GitHub Actions workflows are already present and can be extended for linting, testing, and publishing.
  • Custom builds: additional scripts like install-conda.sh and uninstall-conda.sh support environment setup and teardown, aiding reproducibility.

Project structure

API definitions

EcoJupyter's front-end connects with the server's back-end using the IPython kernel through the IKernelConnection.executeRequest() channelโ€”used to execute Kernel request on demand, written in Python or as a shell script. In the future a full-fledge RESTful API should be implemented to properly enforce types, definitions and methods. For the POC timeline this was the most reasonable trade-off between flexibility and effectiveness.

The methods can be found in apiScripts.ts module file, with all the API-like methods used defined and self-described.

Folder Structure

EcoJupyter/
โ”œโ”€โ”€ .copier-answers.yml
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ .prettierignore
โ”œโ”€โ”€ .yarnrc.yml
โ”œโ”€โ”€ CHANGELOG.md
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ RELEASE.md
โ”œโ”€โ”€ Untitled.ipynb
โ”œโ”€โ”€ install.json
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ pyproject.toml
โ”œโ”€โ”€ setup.py
โ”œโ”€โ”€ tsconfig.json
โ”œโ”€โ”€ yarn.lock
โ”œโ”€โ”€ .github
โ”‚   โ””โ”€โ”€ workflows
โ”‚       โ”œโ”€โ”€ binder-on-pr.yml
โ”‚       โ”œโ”€โ”€ build.yml
โ”‚       โ”œโ”€โ”€ check-release.yml
โ”‚       โ”œโ”€โ”€ enforce-label.yml
โ”‚       โ”œโ”€โ”€ prep-release.yml
โ”‚       โ”œโ”€โ”€ publish-release.yml
โ”‚       โ””โ”€โ”€ update-integration-tests.yml
โ”œโ”€โ”€ assets
โ”‚   โ””โ”€โ”€ EcoJupyter_screenshot.png
โ”œโ”€โ”€ ecojupyter
โ”‚   โ””โ”€โ”€ __init__.py
โ””โ”€โ”€ scripts
โ”‚   โ”œโ”€โ”€ add-catalogue-entry.sh
โ”‚   โ”œโ”€โ”€ build-rel-package.sh
โ”‚   โ”œโ”€โ”€ install-conda.sh
โ”‚   โ”œโ”€โ”€ start-jupyterlab-dev.sh
โ”‚   โ””โ”€โ”€ uninstall-conda.sh
โ””โ”€โ”€ src
    โ”œโ”€โ”€ api
    โ”‚   โ”œโ”€โ”€ ApiTemp.ts
    โ”‚   โ”œโ”€โ”€ api-temp-openapi.yml
    โ”‚   โ”œโ”€โ”€ apiScripts.ts
    โ”‚   โ”œโ”€โ”€ getCarbonIntensityData.ts
    โ”‚   โ”œโ”€โ”€ getScaphData.ts
    โ”‚   โ”œโ”€โ”€ handleNotebookContents.ts
    โ”‚   โ””โ”€โ”€ monitorCellExecutions.ts
    โ”œโ”€โ”€ components
    โ”‚   โ”œโ”€โ”€ FetchMetricsComponents.tsx
    โ”‚   โ”œโ”€โ”€ KPIComponent.tsx
    โ”‚   โ”œโ”€โ”€ KpiValue.tsx
    โ”‚   โ”œโ”€โ”€ MetricSelector.tsx
    โ”‚   โ””โ”€โ”€ ...
    โ”œโ”€โ”€ dialog
    โ”‚   โ””โ”€โ”€ CreateChartDialog.tsx
    โ”œโ”€โ”€ helpers
    โ”‚   โ”œโ”€โ”€ constants.ts
    โ”‚   โ”œโ”€โ”€ types.ts
    โ”‚   โ””โ”€โ”€ utils.ts
    โ”œโ”€โ”€ index.ts
    โ””โ”€โ”€ widget.tsx

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

ecojupyter-0.1.246.tar.gz (1.6 MB view details)

Uploaded Source

File details

Details for the file ecojupyter-0.1.246.tar.gz.

File metadata

  • Download URL: ecojupyter-0.1.246.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for ecojupyter-0.1.246.tar.gz
Algorithm Hash digest
SHA256 2918ad5b5da49a6849461016ec98436d280d19657adfadc8cd364ba9cf9d579f
MD5 b3e1f96a0205de5b7c6c07f2de23de14
BLAKE2b-256 7e4c827c2504c6bde4d29e387cd109415348268f576f5dac598354f8c3c92de2

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