Contributing
April 26, 2026 ยท View on GitHub
Thanks for contributing! To keep the project healthy and maintainable, please follow these guidelines:
- Fork the repo and create a branch from
main. - Keep changes focused and small.
Table of Contents
Coding
- Initial word: The extension is built with TypeScript (
src/), and helper scripts are in Python (src/scripts/). They run thecodecarbonlibrary to track emissions. As you will see, part of the complexity of this setup comes from coordinating between the TypeScript extension and the Python scripts.
The UI: Typescript code (src/)
- Follow existing style and keep functions/modules simple.
- Install Node and npm, then build the extension:
npm install
npm run build
- Run lint before opening a PR:
npm run lint
Python scripts (src/scripts)
- Keep script output stable:
tracker.pyemitsMETRICS:<json>lines consumed by the extension. - Validate Python changes with:
npm run test:python
- The extension needs to handle if the user has Python installed and if
codecarbonis available. If it does not, please open an issue to track this improvement. - Quick manual check (optional):
your_python_interpreter src/scripts/tracker.py start
- For example, me I use uv:
uv run src/scripts/tracker.py start
Manual testing in VS Code (debug)
- In VS Code, open this repo.
- Start the
Run Extensionlaunch configuration. For that go toRun>Start Debuggingor runF5. This will open a new version of VS Code with the Codecarbon extension loaded. - See if your changes work as expected in the new VS Code window. Check the extension's output and behavior.
Testing
Run the tests with:
npm test
You can also run tests by layer:
npm run test:smoke
npm run test:python
npm run test:ts
Note on Codecarbon
This VSCode extension relies on codecarbon to track emissions. Check the codecarbon repo for more details on how it works and how to contribute to it as well.