Thank you for your interest in contributing to the Python Environments extension! This guide will help you get started.
- Node.js (LTS version recommended)
- npm
- VS Code Insiders (recommended for development)
- Git
- Python
-
Clone the repository
cd vscode-python-environments -
Create a Python virtual environment
A Python virtual environment is important for development because it isolates the Python dependencies used for testing and development from your system Python installation. This ensures reproducible builds and prevents conflicts with other projects.
Using the Python Environments extension (recommended):
- Open the Command Palette (
Ctrl+Shift+P/Cmd+Shift+P) - Run Python: Create Environment
- Select Venv as the environment type
- Choose your preferred Python interpreter
- The extension will create the
.venvfolder and configure your workspace automatically
Alternatively, from the command line:
# Create the virtual environment python -m venv .venv # Activate it (Linux/macOS) source .venv/bin/activate # Activate it (Windows - Command Prompt) .venv\Scripts\activate.bat # Activate it (Windows - PowerShell) .venv\Scripts\Activate.ps1
Note: Keep the virtual environment activated while developing. The extension uses this environment for running Python-related tests and for environment discovery during development.
- Open the Command Palette (
-
Install dependencies
npm install
-
Build and watch
npm run watch
-
Run tests
npm run unittest
- Open the project in VS Code
- Press
F5to launch the Extension Development Host - The extension will be loaded in the new VS Code window
- Localization: Use VS Code's
l10nAPI for all user-facing messages - Logging: Use
traceLogortraceVerboseinstead ofconsole.log - Error Handling: Track error state to avoid duplicate notifications
- Documentation: Add clear docstrings to public functions
Run unit tests with the different configurations in the "Run and Debug" panel
This project requires contributors to sign a Contributor License Agreement (CLA). When you submit a pull request, a CLA bot will automatically check if you need to provide a CLA and guide you through the process. You only need to do this once across all Microsoft repositories.
This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with questions.
The npm package under api/ is the public API facade other extensions consume. Its entry point, api/src/main.ts, is a copy of src/api.ts — the single source of truth — and is not committed (see api/.gitignore).
- Edit the API only in
src/api.ts. This file contains the full public surface, including the runtimePythonEnvironments.api()helper andEXTENSION_ID.api/src/main.tsis a build artifact — never edit or commit it. api/src/main.tsis produced by the publish pipeline (build/azure-pipeline.npm.yml), which copiessrc/api.tstoapi/src/main.tsbefore compiling. The api package is therefore built in CI only; to build it locally, copy the file first (e.g.cp src/api.ts api/src/main.ts).src/api.tsitself is validated on every PR by the extension's own lint and TypeScript compile.- Versioning: the published package version in
api/package.jsonmust always match the extension version inpackage.json. CI enforces this viascripts/compare_package_versions.py. Additionally, any PR that editssrc/api.tsmust bumpapi/package.json(use theskip api versionlabel to bypass) and add an entry toapi/CHANGELOG.md(use theskip api changeloglabel to bypass). When bumping, update bothpackage.jsonfiles so they stay in sync.
- Questions: Start a discussion
- Bugs: File an issue
- Feature Requests: Start a discussion
Thank you for contributing! 🎉