- Add architecture, CI/CD, CLI reference documentation - Update installation, operations, and quick-start guides - Add Jupyter workflow and queue documentation - New landing page and research runner plan
5.1 KiB
5.1 KiB
Development Guide
This guide helps developers set up their environment and contribute effectively to FetchML.
Quick Setup
# Clone the repository
git clone <your-repo>
cd fetch_ml
# Start development environment
make dev-up
# Run tests
make test
Development Environment
Prerequisites
- Go 1.25+
- Zig 0.15+
- Python 3.11+
- Docker & Docker Compose
- Redis
Local Development Setup
-
Install Go dependencies
go mod download go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest -
Install Zig tools
# Zig is required for building the CLI and running CLI tests zig version -
Setup Python environment
python -m venv venv source venv/bin/activate # or venv\Scripts\activate on Windows # Python is optional (used for a few helper scripts) -
Optional: Install pre-commit hooks
# If you want automated code quality checks pre-commit install pre-commit install --hook-type commit-msg
Development Workflow
Making Changes
-
Create a feature branch:
git checkout -b feature/your-feature-name -
Make your changes with live feedback:
# Build Go services + Zig CLI make dev # Run specific tests make test-unit make test-integration -
Run quality checks:
# Lint and format (if you have tools configured) make lint # Full test suite make test-full # Optional: Pre-commit checks pre-commit run --all-files
Testing Strategy
- Unit tests: Fast tests for individual components
- Integration tests: Test component interactions
- E2E tests: Full workflow validation
- Performance tests: Load and stress testing
# Run tests by type
make test-unit # Unit tests only
make test-integration # Integration tests only
make test-e2e # End-to-end tests only
make benchmark # Benchmarks
make load-test # Load tests
# Run with coverage
make test-coverage
# Watch mode for development
# (no watch mode target; run specific package tests with go test -run)
Code Quality
Formatting
- Go:
gofmtandgoimports - Zig: Built-in formatter
- Python:
black - YAML:
yamllint - Shell:
shellcheck
Linting
- Go:
golangci-lint - Python:
pylint - Docker:
hadolint - Shell:
shellcheck
Conventional Commits
We use conventional commits for clear commit messages:
feat: add new feature
fix: bug fix
docs: documentation changes
style: formatting changes
refactor: code refactoring
test: add or update tests
chore: maintenance tasks
Performance Monitoring
Local Monitoring
# Start monitoring stack
make dev-up
# View metrics
open http://localhost:3000 # Grafana
open http://localhost:9090 # Prometheus
Performance Testing
# Load test API
make load-test
# Performance benchmarks
make benchmark
# Memory profiling
make profile-memory
Database Management
Development Database
# Reset database
make db-reset
# Run migrations
make db-migrate
# Access database
docker-compose exec redis redis-cli
Schema Changes
- Update migration files in
internal/storage/ - Test with
make db-test-migration - Update documentation
Configuration
Environment Variables
Copy .env.example to .env.local and adjust:
cp .env.example .env.local
Key variables for development:
LOG_LEVEL: Set todebugfor verbose loggingAPI_PORT: API server port (default: 9101)
Configuration Files
configs/api/dev.yaml: Development (Docker) API server configurationconfigs/api/homelab-secure.yaml: Homelab secure API server configurationconfigs/api/prod.yaml: Production API server configurationconfigs/workers/docker.yaml: Docker worker configurationconfigs/workers/worker-prod.toml: Production worker configuration
IDE Setup
Recommended Extensions
VS Code:
- Go (golang.go)
- Zig (ziglang.vscode-zig)
- Python (ms-python.python)
- Docker (ms-azuretools.vscode-docker)
- YAML (redhat.vscode-yaml)
Neovim:
- Go language server (gopls)
- Zig language server (zls)
- Python LSP (pylsp)
- Docker integration
Configuration
Set up your preferred editor with:
- Go formatting (gofmt, goimports)
- Zig formatting (built-in)
- Python formatting (black, autopep8)
- YAML linting (yamllint)
Configure these tools according to your workflow preferences.
Troubleshooting
Common Issues
- Go modules not found: Run
go mod download - Zig build fails: Check Zig version with
zig version - Docker containers not starting: Check Docker daemon
- Redis connection failed: Start Redis with
docker-compose up redis
Getting Help
- Check logs:
make logs - Run diagnostics:
make doctor - Review troubleshooting guide: docs/src/troubleshooting.md
Contributing
- Follow the code of conduct
- Use conventional commits
- Add tests for new features
- Update documentation
- Ensure all checks pass
See CONTRIBUTING.md for detailed guidelines.