Editor Setup Guide
This guide covers setting up VS Code (recommended) and PyCharm for our development stack.
VS Code Setup (Recommended)
Installation
Download from code.visualstudio.com
Required Extensions
Install these extensions (Cmd+Shift+X or Ctrl+Shift+X):
Python:
- Python (Microsoft) -
ms-python.python - Pylance (Microsoft) -
ms-python.vscode-pylance - Ruff (Charliermarsh) -
charliermarsh.ruff
JavaScript/TypeScript:
4. Bun (Oven) - oven.bun-vscode
5. Biome (Biomejs) - biomejs.biome (replaces ESLint + Prettier)
General:
7. GitLens (GitKraken) - eamodio.gitlens
8. Docker (Microsoft) - ms-azuretools.vscode-docker
9. EditorConfig (EditorConfig) - editorconfig.editorconfig
Database:
10. SQLTools (Matheus Teixeira) - mtxr.sqltools
11. SQLTools PostgreSQL (Matheus Teixeira) - mtxr.sqltools-driver-pg
Optional but Useful:
- TODO Highlight -
wayou.vscode-todo-highlight - Error Lens -
usernamehw.errorlens - Auto Rename Tag -
formulahendry.auto-rename-tag - Path Intellisense -
christian-kohler.path-intellisense
Settings Configuration
Create .vscode/settings.json in your project:
{
// Editor
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "always"
},
"editor.rulers": [88, 100],
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
// Python
"python.defaultInterpreterPath": "${workspaceFolder}/venv/bin/python",
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "always"
}
},
"python.analysis.typeCheckingMode": "basic",
// JavaScript/TypeScript
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[javascriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
// JSON/YAML
"[json]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[jsonc]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[yaml]": {
"editor.defaultFormatter": "biomejs.biome"
},
// Git
"git.autofetch": true,
"git.confirmSync": false,
// Files
"files.exclude": {
"**/__pycache__": true,
"**/*.pyc": true,
"**/.pytest_cache": true,
"**/.mypy_cache": true,
"**/node_modules": true
},
"search.exclude": {
"**/node_modules": true,
"**/.venv": true,
"**/venv": true
}
}
Debugging Configuration
Create .vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "FastAPI",
"type": "python",
"request": "launch",
"module": "uvicorn",
"args": [
"app.main:app",
"--reload",
"--host",
"0.0.0.0",
"--port",
"8000"
],
"jinja": true,
"justMyCode": false,
"env": {
"ENVIRONMENT": "local"
}
},
{
"name": "Pytest: Current File",
"type": "python",
"request": "launch",
"module": "pytest",
"args": ["${file}", "-v"],
"console": "integratedTerminal",
"justMyCode": false
},
{
"name": "Pytest: All Tests",
"type": "python",
"request": "launch",
"module": "pytest",
"args": ["-v"],
"console": "integratedTerminal",
"justMyCode": false
}
]
}
Keyboard Shortcuts
Useful shortcuts (macOS / Windows):
| Action | macOS | Windows |
|---|---|---|
| Command Palette | Cmd+Shift+P | Ctrl+Shift+P |
| Quick Open | Cmd+P | Ctrl+P |
| Find in Files | Cmd+Shift+F | Ctrl+Shift+F |
| Toggle Terminal | Ctrl+` | Ctrl+` |
| Format Document | Shift+Option+F | Shift+Alt+F |
| Go to Definition | F12 | F12 |
| Find All References | Shift+F12 | Shift+F12 |
| Rename Symbol | F2 | F2 |
| Toggle Comment | Cmd+/ | Ctrl+/ |
Database Connection
Using SQLTools:
- Click SQLTools icon in sidebar
- Click “Add New Connection”
- Select PostgreSQL
- Enter details:
Connection name: Local Dev Server: localhost Port: 5432 Database: yourapp_dev Username: postgres Password: postgres - Test connection → Save
PyCharm Setup (Alternative)
Installation
Download PyCharm Professional from jetbrains.com/pycharm
Configuration
1. Set Python Interpreter:
- Settings → Project → Python Interpreter
- Add → Virtualenv Environment → Existing environment
- Select
venv/bin/python
2. Enable EditorConfig:
- Settings → Editor → Code Style
- ✅ Enable EditorConfig support
3. Configure Black:
- Settings → Tools → Black
- ✅ On save
- ✅ On code reformat
- Arguments:
--line-length 88
4. Configure isort:
- Settings → Tools → Actions on Save
- ✅ Run isort
- Configuration:
--profile black
5. Configure flake8:
- Settings → Tools → External Tools → Add
- Name: flake8
- Program:
$ProjectFileDir$/venv/bin/flake8 - Arguments:
$FilePath$
6. Database Tools:
- View → Tool Windows → Database
- → PostgreSQL
- Enter connection details
- Test connection → OK
Linter Configuration
.editorconfig
Copy from templates:
cp docs/04-templates/.editorconfig .editorconfig
This configures basic editor behaviour (spaces vs tabs, line endings, etc.)
Python: .flake8 (DEPRECATED)
Note: .flake8 is no longer used - Ruff replaces flake8. All configuration is in pyproject.toml under [tool.ruff].
Python: pyproject.toml
[tool.ruff]
line-length = 88
target-version = "py311"
[tool.ruff.lint]
select = ["E", "W", "F", "I", "B", "C4", "UP"]
ignore = ["E501"]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
[tool.ty]
# ty uses smart defaults
strict = true
[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
JavaScript/TypeScript: biome.json
Biome replaces both ESLint and Prettier:
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 100
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"trailingCommas": "es5",
"semicolons": "always"
}
}
}
Format on Save
VS Code
Already configured in settings.json:
"editor.formatOnSave": true
PyCharm
Settings → Tools → Actions on Save:
- ✅ Reformat code
- ✅ Optimize imports
- ✅ Run isort
Verification
Test that everything works:
1. Create test file:
# test_format.py
import sys
from typing import List
def hello(name:str)->str:
return f"Hello {name}"
x=hello("World")
print(x)
2. Save file:
- File should auto-format on save
- Imports should be sorted
- Spacing should be corrected
3. Expected result:
# test_format.py
import sys
from typing import List
def hello(name: str) -> str:
return f"Hello {name}"
x = hello("World")
print(x)
Troubleshooting
Format on Save Not Working
VS Code:
- Check Settings → search “format on save”
- Ensure it’s enabled
- Check formatter is selected for language
- Reload window: Cmd+Shift+P → “Reload Window”
PyCharm:
- Settings → Tools → Actions on Save
- Ensure “Reformat code” is checked
- Check Python interpreter is set correctly
Linter Not Running
VS Code:
- Check extension is installed and enabled
- Check virtual environment is activated
- Reload window
PyCharm:
- Settings → Editor → Inspections
- Ensure Python inspections are enabled
- Check interpreter is correct
EditorConfig Not Working
- Ensure EditorConfig extension installed (VS Code)
- Ensure .editorconfig is in project root
- Reload editor
Best Practices
✅ Do:
- Use same editor settings as team
- Configure format on save
- Keep extensions updated
- Use linter recommendations
- Configure debugger
❌ Don’t:
- Ignore linter warnings
- Skip EditorConfig
- Have different settings per project
- Commit editor-specific files (
.idea/,.vscode/)
Next Steps
- Set up pre-commit hooks:
pre-commit-hooks.md - Review code standards:
../02-standards/code-standards.md - Configure API testing:
api-testing.md