VS Code and Venv Tips

This page provides concise information about using Visual Studio Code (VS Code) and Python virtual environments (venv).

Visual Studio Code (VS Code)

VS Code settings have been configured during the installation process using the PrepareDevEnv script.

To benefit from these settings, open the sostrades-dev-tools directory in VS Code by running the following command in the terminal:

code .

Using venv in VS Code

  1. Open the command palette by pressing Ctrl + Shift + P.

  2. Search for “Python: Select Interpreter” and select it.

Select Interpreter

  1. Choose “Python 3.12.x (‘.venv’)”.

Select Python

Now you can run any SoSTrades code from VS Code.

Using venv

To activate the virtual environment with all the required packages installed, run the following command from the sostrades-dev-tools folder:

Windows

.venv/Scripts/activate

Linux

. .venv/bin/activate

To deactivate the virtual environment, use the following command:

deactivate