This sample repo contains the recommended structure for a Python script. In this example, we use pytest
to test features in your script.
For a more in-depth tutorial, see our Python tutorial.
The code in this repo aims to follow Python style guidelines as outlined in PEP 8.
- Open the template folder in VS Code (File > Open Folder...)
- Select a Python interpreter using Python: Select Interpreter in the Command Palette (View > Command Palette)
- Run
main.py
using the Play Button in the top right corner or by selecting Python > Python File in Terminal from the context menu or Command Palette - To test the Python code, create a Python virtual environment using the Python: Create Environment command found in the Command Palette. Ensure you install dependencies found in the
dev-requirements.txt
file - Ensure your newly created environment is selected using the Python: Select Interpreter command found in the Command Palette
- Navigate to the Test Panel to configure your Python test or by triggering the Python: Configure Tests command from the Command Palette
- Run tests in the Test Panel or by clicking the Play Button next to the individual tests in the
test_date_time.py
file