Developer Documentation
This guide is for contributors and maintainers of the dapy project.
Project Structure
The dapy project consists of two main components:
- dapy library (
src/dapy/) - Core framework for defining and simulating distributed algorithms - dapyview application (
src/dapyview/) - Standalone GUI trace viewer
Development Setup
Prerequisites
- Git
- uv package manager (recommended)
- Python 3.13 or higher (not necessary if using
uv)
Initial Setup
- Clone the repository:
git clone https://github.com/xdefago/dapy.git cd dapy - Install dependencies with uv:
uv sync --all-groupsThis installs all dependencies including dev tools (pytest, black, ruff, pdoc).
- Verify installation:
python example.py uv run dapyview examples/sample_trace.json
Alternative: Using pip
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install in editable mode with all extras
pip install -e ".[dev,ui]"
Building Dapyview Executables
Dapyview standalone executables are built using PyInstaller and distributed via GitHub releases.
Local Build
Build for your current platform:
./scripts/build-dapyview.sh
This creates platform-specific executables in dist/:
- macOS:
dapyview-macos-arm64ordapyview-macos-x86_64 - Linux:
dapyview-linux-x86_64 - Windows:
dapyview-windows-x86_64.exe
Testing Local Build
# macOS
./dist/dapyview-macos-arm64 examples/sample_trace.json
# Linux
./dist/dapyview-linux-x86_64 examples/sample_trace.json
# Windows
dist\dapyview-windows-x86_64.exe examples\sample_trace.json
Release Process
The project uses GitHub Actions to automatically build multi-platform executables when you push a version tag.
Creating a Release
- Update version number in
pyproject.toml:[project] version = "0.3.0" - Commit the version change:
git add pyproject.toml git commit -m "Bump version to 0.3.0" - Create and push a git tag:
git tag -a v0.3.0 -m "Release version 0.3.0" git push origin main git push origin v0.3.0 - GitHub Actions automatically:
- Builds executables for macOS (arm64 + x86_64), Linux (x86_64), and Windows (x86_64)
- Creates a GitHub Release draft
- Uploads all executables as release assets
- Edit the GitHub Release:
- Go to https://github.com/xdefago/dapy/releases
- Edit the auto-created draft release
- Add release notes describing changes
- Publish the release
What Gets Built
The CI builds the following artifacts:
dapyview-v0.3.0-macos-arm64- macOS Apple Silicondapyview-v0.3.0-macos-x86_64- macOS Inteldapyview-v0.3.0-linux-x86_64- Linux 64-bitdapyview-v0.3.0-windows-x86_64.exe- Windows 64-bit
Users can download and run these directly without Python installed.
Distribution Methods
For End Users (Writing Algorithms)
Install the dapy library from GitHub (no cloning required):
pip install "git+https://github.com/xdefago/dapy.git"
This gives them:
- The
dapylibrary for algorithm development - The
dapyviewCLI command (requires Python and PySide6)
For Trace Viewers Only
Download the standalone executable from GitHub releases:
https://github.com/xdefago/dapy/releases
No Python installation required - just download and run.
For Developers
Clone and install in editable mode (as described above in Development Setup).
Running Tests
# Run all tests
uv run pytest
# Run with coverage
uv run pytest --cov=src/dapy --cov-report=html
# Run specific test file
uv run pytest tests/test_topology.py
# Run with verbose output
uv run pytest -v
Code Quality
Linting
# Check code with ruff
uv run ruff check src/
# Auto-fix issues
uv run ruff check --fix src/
Formatting
# Format code with black
uv run black src/
# Check formatting without changes
uv run black --check src/
Type Checking
# Run mypy (if configured)
uv run mypy src/dapy
Documentation
Generate API Documentation
# Generate HTML docs with pdoc
uv run pdoc dapy --output-dir docs/api
# Serve docs locally
uv run pdoc dapy
Update GitHub Pages
The docs/ directory contains the Jekyll-based GitHub Pages site. To update:
- Edit markdown files in
docs/ - Test locally if needed (requires Jekyll)
- Commit and push - GitHub Pages auto-deploys from
mainbranch
PyInstaller Configuration
The dapyview.spec file controls how PyInstaller builds the executable. Key configurations:
- Entry point:
src/dapyview/main.py - Hidden imports: All dapy/dapyview modules, PySide6 components
- Data files: Source code included for trace loading
- Excluded packages: Development tools, testing frameworks (reduces size)
- UPX compression: Enabled for smaller executables
- Console: Disabled (GUI app)
Modifying the Build
If you add new dependencies or modules:
- Update
hiddenimportslist indapyview.spec - Test the build locally:
./scripts/build-dapyview.sh - Verify the executable works without Python installed
Troubleshooting
Build Fails on macOS
If you get code signing errors:
# Disable code signing in dapyview.spec
codesign_identity=None
Missing Dependencies in Executable
If the built executable crashes with import errors:
- Check
hiddenimportsindapyview.spec - Add missing modules
- Rebuild
CI Build Fails
Check the GitHub Actions logs for:
- Python version mismatch
- Missing system dependencies (Linux)
- uv installation issues
Contributing
When contributing code:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Run tests and linters locally
- Submit a pull request
See CONTRIBUTING.md (if it exists) for detailed guidelines.
Version Sync
The dapyview version is automatically synced with the dapy library version from pyproject.toml using importlib.metadata. When you bump the version:
- Update
pyproject.toml - Both dapy and dapyview will report the same version
- No need to update version strings elsewhere
Check version:
python -c "import dapy; print(dapy.__version__)"
uv run dapyview --version
Maintenance Tasks
Updating Dependencies
# Update all dependencies to latest compatible versions
uv lock --upgrade
# Update specific dependency
uv add --upgrade package-name
Security Audits
# Check for known vulnerabilities
uv run pip-audit
Cleaning Build Artifacts
# Remove build directories
rm -rf build/ dist/ *.spec.bak
# Remove Python cache
find . -type d -name "__pycache__" -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
Contact
For questions or issues:
- GitHub Issues: https://github.com/xdefago/dapy/issues
- Email: (maintainer contact)