π₯οΈ Developed using Microsoft Visual Studio Code¶
The automation files, used to prepare the virtual environment and run the scripts, are located in the .vscode folder.
File Descriptions¶
π File: tasks.json. π Documented below: π§ Running Tasks
- task: PowerShell Create virtual environment
Once the Python version has been selected and installed, the disk path to python_bin is configured to create the virtual environment. Commands are executed in the samples root folder.
- task: PowerShell Delete Temporary Files:
venv/
tmp/
logs/
π File: launch.json. π Documented below: π Running Launch Configurations
Once created in a virtual environment, from vscode, by clicking on a file, for example: scripts/python/sample_01_connection_status.py, proceed to use the "Run and Debug (Ctrl+Shift+D)" option, which executes <sample>.py using the virtual environment.
The script will be executed using the assigned virtual environment binary.
> .\venv\Scripts\python.exe ... <sample>.py
βΆοΈ Execution modes¶
π§ Running Tasks¶
β¨οΈ Keyboard method¶
- Press:
Ctrl + Shift + P (Windows / Linux)
Cmd + Shift + P (macOS) - Type:
Tasks: Run Task - Press Enter
- Select the task you want to run.
π±οΈ Mouse method¶
- Open the menu:
View β Command Paletteβ¦ - Type Tasks: Run Task
- Click on the option.
- Select the task from the list.
π Running Launch Configurations (Run / Debug)¶
Launch configurations in .vscode/launch.json allow running or debugging Python scripts in a controlled way.
β¨οΈ Keyboard method¶
- F5 β Start debugging
- Ctrl + F5 β Run without debugging
To select another configuration:
- Press Ctrl + Shift + P
- Type: Debug: Select and Start Debugging
- Select the desired launch configuration.
π±οΈ Mouse method¶
- Open the Run and Debug view (icon βΆοΈπ).
- At the top, select the launch configuration from the dropdown menu.
- Click:
- βΆοΈ Run to execute
- βΆοΈπ Start Debugging to debug