Skip to main content

EcoCode — energy and performance profiler for source code (CLI core for the EcoCode VS Code extension)

Project description

EcoCode

Try the VS Code extension on Marketplace: EcoCode Insights

EcoCode Insights logo

EcoCode is an open-source toolkit to measure the energy impact of your code, detect regressions, and guide more efficient optimizations.

In action

Inline optimization suggestions (squiggles + code actions), a workspace dashboard, and honest "measured vs estimated" labels.

Optimization suggestions and inline diagnostics

Workspace summary dashboard

Top files with measured/estimated badges

Current file metrics

Stability panel

Install

pip install ecocode-cli

This installs the ecocode command (Python 3.10+). A few examples:

ecocode profile path/to/script.py            # profile a single file
ecocode profile-repo --root .                # scan a whole repository
ecocode optimize suggest path/to/script.py   # optimization suggestions

Prefer a GUI? Install the VS Code extension — it drives the same CLI.

What this project is for?

EcoCode helps answer very practical questions:

  • Is this script consuming more than before?
  • Is a PR degrading performance and energy usage?
  • Which files or code areas are the most expensive?
  • Which optimizations should be prioritized first?

In practice, the CLI already lets you:

  • profile a script (CPU, memory, estimated energy),
  • create a baseline and compare future runs,
  • scan an entire repository,
  • track trends over time,
  • generate optimization suggestions,
  • export results for CI tooling (JSON/SARIF).

Why it is useful?

The project makes an often invisible topic visible: the runtime cost of software.

In a team workflow, this makes it easier to:

  • compare changes with real numbers instead of guesswork,
  • catch energy regressions before they reach production,
  • add energy checks to CI the same way we already gate tests and linting,
  • improve performance and reliability without losing sight of sustainability.

Where we are going?

The goal is to become a reference platform for sustainable software engineering:

  • increasingly reliable, cross-platform runtime measurement,
  • deeper repository analysis,
  • smarter optimization recommendations,
  • simpler integration into team workflows.

AI suggestions are optional

EcoCode works fully offline with deterministic, rule-based suggestions — no API key needed. AI-powered suggestions are opt-in, configured in ecocode.toml:

  • Local (Ollama): a model runs on your machine; your code never leaves it; no key. The endpoint is configurable via ECOCODE_OLLAMA_BASE_URL (HTTP or HTTPS).
  • Remote (Anthropic): higher quality, but your source is sent to the API, so it needs your own key via the ECOCODE_LLM_API_KEY environment variable. The key is read only from the environment — never stored in ecocode.toml, VS Code settings, or the repository.
export ECOCODE_LLM_API_KEY="sk-ant-..."   # only needed for the remote provider

Full documentation

If you want full details (commands, outputs, examples, roadmap, etc.), see the complete project documentation:

documentation.md

Contributing

If the project interests you and you want to help:

You can:

  • propose new features,
  • add new functionality,
  • fix potential issues and bugs,
  • improve the app's reliability,
  • submit pull requests.

See also:

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

ecocode_cli-0.2.0.tar.gz (45.2 kB view details)

Uploaded Source

Built Distribution

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

ecocode_cli-0.2.0-py3-none-any.whl (44.6 kB view details)

Uploaded Python 3

File details

Details for the file ecocode_cli-0.2.0.tar.gz.

File metadata

  • Download URL: ecocode_cli-0.2.0.tar.gz
  • Upload date:
  • Size: 45.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for ecocode_cli-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0b89e32bd282ba08c01aedb6ea2dac8707032abe9432680f520477e3c60f94ff
MD5 058cb151274e0ab0af25c41a2ff51594
BLAKE2b-256 1bc73a50ae45cd6f4ca6492931cbc82bf50ba3ee8241d8826c7d63ba3187e5f7

See more details on using hashes here.

File details

Details for the file ecocode_cli-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ecocode_cli-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 44.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for ecocode_cli-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 77f4b3a7c8c8f4ed56111876bf1e9e197611c3d43cbaf3f71b43400c7b03669c
MD5 518b90cd301704f9662457fe5f5b4ef9
BLAKE2b-256 62d97529ac26ab081855c362fb555ca0cb4f1dd5c8ad5a5b8fb25d6bddc0d272

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