Development Guide¶
This guide covers setting up a development environment and contributing to Squirrel Backend.
For the project layout, see Architecture › Directory Structure. For detailed local-install steps, see Installation › Local Development.
Development Workflow¶
Making Changes¶
- Create a feature branch
- Make your changes
- Run tests:
pytest - Run linting:
ruff check . - Run type checking:
mypy app/ - Submit a pull request
Hot Reload¶
The API server supports hot reload with --reload:
Changes to Python files will automatically restart the server.
Debugging¶
Enable debug logging:
Utility Scripts¶
The scripts/ directory contains management commands for API keys. See API Key Management for full usage of create_key.py, list_keys.py, and deactivate_key.py.
IDE Setup¶
VS Code¶
Recommended extensions:
- Python
- Pylance
- Ruff
Settings (.vscode/settings.json):
{
"python.defaultInterpreterPath": "./venv/bin/python",
"python.analysis.typeCheckingMode": "basic",
"[python]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
},
"editor.defaultFormatter": "charliermarsh.ruff"
}
}
PyCharm¶
- Set project interpreter to
./venv/bin/python - Enable Ruff plugin
- Configure pytest as default test runner
Pre-commit Hooks¶
The project uses pre-commit hooks for code quality:
Next Steps¶
- Testing — running and writing tests
- Database Migrations — managing schema changes
- Code Quality — linting and formatting
- E-log Plugin — writing an adapter for a different e-log backend