VSCodium Python Virtual Environment Setup
Overview
VSCodium is configured to automatically use the project's virtual environment located at .venv/.
Configuration
The .vscode/settings.json file contains the following Python-specific settings:
Python Interpreter
- Default Interpreter Path:
${workspaceFolder}/.venv/bin/python - Python Path:
${workspaceFolder}/.venv/bin/python
These settings ensure VSCodium always uses the project's virtual environment.
Terminal Activation
- Activate Environment:
true- Auto-activates venv when opening integrated terminal - Activate in Current Terminal:
true- Activates venv in already open terminals - Environment File:
${workspaceFolder}/.env.local- Loads environment variables
Testing Configuration
- Pytest Enabled:
true - Pytest Path:
${workspaceFolder}/.venv/bin/pytest - Test Discovery: Automatically discovers tests on save
- Working Directory: Uses workspace folder as CWD
Analysis Paths
The following paths are added for Python analysis:
${workspaceFolder}${workspaceFolder}/app${workspaceFolder}/services
Verification
To verify the setup is working correctly:
- Open VSCodium from the project root:
cd /home/paulb/tracker-restapi
vscodium .
- Check Python interpreter:
- Open Command Palette (Ctrl+Shift+P)
- Type "Python: Select Interpreter"
-
Verify
.venv/bin/pythonis selected -
Check terminal activation:
- Open a new integrated terminal (Ctrl+`)
- Verify the prompt shows
(.venv)prefix -
Run:
which python- should show.venv/bin/python -
Test Python path:
Should output:python -c "import sys; print(sys.executable)"/home/paulb/tracker-restapi/.venv/bin/python
Troubleshooting
Virtual Environment Not Activating
If the virtual environment doesn't activate automatically:
- Reload VSCodium:
-
Command Palette → "Developer: Reload Window"
-
Manually select interpreter:
- Command Palette → "Python: Select Interpreter"
-
Choose
.venv/bin/python -
Check virtual environment exists:
ls -la .venv/bin/python
Tests Not Running
If pytest doesn't work:
- Verify pytest is installed:
.venv/bin/pytest --version
- Check test configuration:
- Open
.vscode/settings.json -
Verify
python.testing.pytestPathpoints to.venv/bin/pytest -
Refresh test discovery:
- Command Palette → "Python: Discover Tests"
Benefits of This Configuration
- Consistency: Everyone on the team uses the same Python environment
- Isolation: Project dependencies don't conflict with system Python
- Automatic: No manual activation needed when opening terminals
- IDE Integration: IntelliSense, linting, and testing use correct Python version
- Environment Variables:
.env.localautomatically loaded for development