Development Setup¶
Setting up your development environment for contributing to WakeBuilder.
Prerequisites¶
- Python 3.12 or higher
- Git
- uv or pip package manager
Clone and Setup¶
1. Fork and Clone¶
2. Create Virtual Environment¶
3. Install Dependencies¶
4. Verify Setup¶
Development Tools¶
Required Tools¶
| Tool | Purpose | Installation |
|---|---|---|
| Black | Code formatting | pip install black |
| Ruff | Linting | pip install ruff |
| pytest | Testing | pip install pytest |
| mypy | Type checking | pip install mypy |
Recommended Tools¶
| Tool | Purpose |
|---|---|
| VS Code | IDE with Python support |
| Pre-commit | Git hooks for formatting |
| htop/nvtop | Resource monitoring |
Project Structure¶
Key directories for development:
WakeBuilder/
├── src/wakebuilder/ # Main source code
│ ├── audio/ # Audio processing
│ ├── backend/ # FastAPI server
│ ├── models/ # ML models
│ └── tts/ # TTS providers
├── tests/ # Test suite
├── frontend/ # Web interface
├── scripts/ # Utilities
└── docs/ # Documentation
Running the Server¶
Development Mode¶
The --reload flag enables auto-restart on code changes.
Debug Mode¶
Making Changes¶
1. Create a Branch¶
2. Make Changes¶
Edit files in src/wakebuilder/
3. Run Tests¶
4. Format Code¶
5. Commit¶
Tips¶
Working with Audio¶
import librosa
# Load audio
audio, sr = librosa.load("test.wav", sr=16000)
# Check properties
print(f"Duration: {len(audio)/sr:.2f}s")
print(f"Shape: {audio.shape}")
Working with Models¶
from wakebuilder.models.classifier import ASTWakeWordModel
# Load model
model = ASTWakeWordModel()
model.load_state_dict(torch.load("model.pt"))