Development
Setting up Development Environment
# Clone repository
git clone https://github.com/robodreamer/dhb-xr.git
cd dhb_xr
# Install in development mode with all dependencies
pip install -e ".[dev,all]"
# Or using Pixi (recommended)
pixi install
Running Tests
# Run all tests
pytest tests/
# Run specific test file
pytest tests/test_encoder.py
# Run with coverage
pytest tests/ --cov=src/dhb_xr --cov-report=html
# Run tests for specific backends
pixi run test-casadi # CasADi optimization tests
Optional CusADi Decode Libraries
The repository includes fixed-horizon .casadi artifacts and generated CUDA
source for CusADi decode. Normal installs use compiled binaries from the dhb_xr
cache when they exist and fall back to CPU decode otherwise.
# Build all supported fixed-horizon libraries into the default cache
pixi run python -m dhb_xr.optimization.build_cusadi_decode --horizons 50 80 100 150 200
# Inspect paths without writing files
pixi run python -m dhb_xr.optimization.build_cusadi_decode --horizons 100 --dry-run
Set DHB_XR_CUSADI_CACHE to use a project-local cache during development or
deployment testing.
Code Quality
# Format code
ruff format src/ tests/
# Lint code
ruff check src/ tests/
# Type checking
mypy src/dhb_xr
Building Documentation
# Build documentation
mkdocs build
# Serve documentation locally
mkdocs serve
Project Structure
dhb_xr/
├── src/dhb_xr/
│ ├── core/ # Core types and geometry
│ ├── encoder/ # DHB encoding functions
│ ├── decoder/ # DHB decoding functions
│ ├── optimization/ # Trajectory optimization
│ ├── database/ # Motion storage and retrieval
│ ├── tokenization/ # VQ-VAE tokenization
│ ├── losses/ # Imitation learning losses
│ ├── visualization/ # Plotting utilities
│ └── utils/ # Additional utilities
├── tests/ # Unit and integration tests
├── examples/ # Example scripts
├── docs/ # Documentation
└── notebooks/ # Jupyter notebooks
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Release Process
Automated PyPI Publishing
- Update version:
pixi run version --bump patchorpixi run version 0.4.0 - Update
CHANGELOG.md - Commit and push changes
- Create and push a matching git tag, for example
git tag v0.4.0 && git push origin v0.4.0 - The tag-triggered release workflow builds and publishes to PyPI
Manual Publishing
pixi run setup-pypirc
pixi run build-dist
pixi run upload-testpypi
python -m pip install -i https://test.pypi.org/simple/ dhb_xr
pixi run upload-pypi
PyPI and TestPyPI API tokens are stored in ~/.pypirc or environment variables.