EcoCode
Try the VS Code extension on Marketplace: EcoCode Insights
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.
Install
pipx install ecocode-cli
pipx installs the ecocode command on your PATH in an isolated environment (Python 3.10+). No pipx yet? sudo apt install pipx (Debian/Ubuntu) or python3 -m pip install --user pipx, then pipx ensurepath. Alternatively, install into a virtual environment: python3 -m venv .venv && .venv/bin/pip install ecocode-cli.
On Debian/Ubuntu/WSL, a plain
pip installinto the system Python is blocked by PEP 668 — use pipx or a venv.
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_KEYenvironment variable. The key is read only from the environment — never stored inecocode.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:
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:
Metadata
Release files for ecocode-cli 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ecocode_cli-0.2.2.tar.gz | 46.1 kB | Without provenance | Details for ecocode_cli-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ecocode_cli-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for ecocode_cli-0.2.2-py3-none-any.whl |
Total release size: 91.0 kB
Release files / ecocode_cli-0.2.2.tar.gz
| Download URL | ecocode_cli-0.2.2.tar.gz |
|---|---|
| Size | 46.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
920526cff9428c4469a3f4f2ab66a0f34e551b91619a80e1762c0928e770f41b
|
|
BLAKE2b-256 checksum How to use checksums |
df695e56dd33dda0c8447eb181fd40ca4d6feb4b080a6012b5c162519a263d1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / ecocode_cli-0.2.2-py3-none-any.whl
| Download URL | ecocode_cli-0.2.2-py3-none-any.whl |
|---|---|
| Size | 44.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2c7d4a4ba54b2dbc88a37189a8124a5dce37e142e1cbe3b11608cbafd13c53ee
|
|
BLAKE2b-256 checksum How to use checksums |
da71576b14d825843c69af8a236cbe364c01618d74d8d48b443cd8e9183bd3fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for ecocode-cli 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.