This is a public repository containing source code for internal training focused on development of Python based extensions using Extension Framework 2.0.
This repository is structured as a Visual Studio Code workspace. Each separate folder is a project within the same workspace. Each folder has its own Python virtual environment, where applicable.
- Visual Studio Code relies on 2 files in the root directory of the repository:
python-extension-training.code-workspace
tells it which projects are considered part of the workspace; and.vscode/settings.json
tells it to exclude certain folders from the root view.
- Each individual project has its own
.vscode
directory with thesettings.json
file, which specifies- Which fiels to exclude (example:
__pycache__
cache files); and - Where to find a Python interpreter for the specific project folder.
- Which fiels to exclude (example:
-
Clone it.
-
Open the
python-extension-training.code-workspace
file with VS Code. -
Create a separate Python virtual environment in each project
Example of creating environment in
test-extension
project foldercd test-extension python -m venv .venv
-
When you press Ctrl + Shift + ` or open a new terminal you can choose which project this terminal belongs to.
-
Once the terminal for that project opens, the virtual environment will be automatically activated:
-
If it's not, you can activate it manually in the terminal by navigating to the correct folder and activating it:
Example for POSIX systems, such as Linux or macOS:
cd test-extensions source .venv/bin/activate
See official Python docs on how to activate a virtual environment on different platforms.
-
Install requirements for that specific virtual environment.
pip install -r requirements.txt
-
That's it!