Development Environment Setup
Orbitron supports multiple development environment options. Choose the one that best fits your workflow:
- Docker + Dev Containers (recommended for new contributors) - Most reproducible, isolated environment
- System Packages (for experienced developers) - Fast, native development with direct GPU access
- Conda Environment (optional) - For users already using conda for scientific computing
2.1 Docker + Dev Containers (Recommended)
Best for: New contributors, reproducible builds, CI/CD alignment
Why use Docker: - ✅ Same environment for everyone, regardless of OS - ✅ Isolated from host system (no dependency conflicts) - ✅ Easy onboarding - just docker-compose up or “Reopen in Container” in VS Code - ✅ Matches CI/CD environment exactly - ✅ No path configuration needed
Prerequisites: - Docker and Docker Compose installed - For VS Code: Dev Containers extension
Quick Start:
Using Docker Compose:
# Build the development image (first time only, or after Dockerfile changes) docker-compose -f docker-compose.dev.yml build # Start interactive shell in container docker-compose -f docker-compose.dev.yml run --rm dev bash # Or run commands directly (no need to enter container) docker-compose -f docker-compose.dev.yml run --rm dev cargo build --workspace docker-compose -f docker-compose.dev.yml run --rm dev cargo testUsing VS Code Dev Containers:
- Open the project in VS Code
- When prompted, click “Reopen in Container”
- Or use Command Palette: “Dev Containers: Reopen in Container”
- VS Code will automatically set up the environment with Rust extensions
Files: - Dockerfile.dev - Development container definition - docker-compose.dev.yml - Docker Compose configuration - .devcontainer/devcontainer.json - VS Code Dev Container configuration
What’s Included: - Rust 1.92.0 (pinned via rust-toolchain.toml; edition 2021) - HDF5 1.12.3 (built from source, compatible with hdf5-sys 0.8.1) - All build dependencies (cmake, pkg-config, etc.) - Cached build artifacts for faster rebuilds
Environment Variables: The container automatically sets: - HDF5_DIR=/usr/local/hdf5-1.12.3 - PKG_CONFIG_PATH=/usr/local/hdf5-1.12.3/lib/pkgconfig - LD_LIBRARY_PATH=/usr/local/hdf5-1.12.3/lib - CARGO_INCREMENTAL=1 (for faster rebuilds)
Running Commands:
# Build entire workspace (first build: 30-60 minutes, subsequent: 2-10 minutes)
docker-compose -f docker-compose.dev.yml run --rm dev cargo build --workspace
# Test
docker-compose -f docker-compose.dev.yml run --rm dev cargo test
# Run CLI (note: use --bin to specify binary)
docker-compose -f docker-compose.dev.yml run --rm dev cargo run -p orbitron-cli --bin orbitron -- --help
# Interactive shell
docker-compose -f docker-compose.dev.yml run --rm dev bashBuild Performance: - First build: 30-60 minutes (compiles all dependencies from scratch) - Subsequent builds: 2-10 minutes (only changed crates recompile) - Build artifacts are cached in Docker volumes for faster rebuilds
Note: GUI viewer requires X11 forwarding or running on the host. For GUI development, consider using System Packages (see §2.2).
2.2 System Packages (Native Development)
Best for: Experienced developers, GUI development, fast iteration
Why use system packages: - ✅ Fast - no container overhead - ✅ Native tooling - direct access to system tools - ✅ GPU access - direct access to GPU for GUI development - ✅ Familiar - standard Rust development workflow
Prerequisites: - Rust toolchain (install via rustup) - System package manager (apt, brew, vcpkg, etc.)
Setup by Platform:
Linux (Debian/Ubuntu):
# Install dependencies
./scripts/install-deps-linux.sh
# Set environment variables
export HDF5_DIR=/usr
export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
# Build
cargo build --workspacemacOS:
# Install Homebrew if not already installed
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install dependencies
./scripts/install-deps-macos.sh
# Set environment variables (add to ~/.zshrc or ~/.bash_profile)
export HDF5_DIR=$(brew --prefix hdf5)
export PKG_CONFIG_PATH="$HDF5_DIR/lib/pkgconfig"
export DYLD_LIBRARY_PATH="$HDF5_DIR/lib:$DYLD_LIBRARY_PATH"
# Build
cargo build --workspaceWindows:
# Prereqs: Visual Studio Build Tools + "Desktop development with C++"
# (MSVC v143 + Windows SDK). Use VS Installer -> Modify -> select workload.
# Option 1: Conda (matches CI)
# 1. Install Miniconda/Anaconda.
# 2. Create env: conda env create -f environment.yml
# 3. Activate: conda activate orbitron-dev
# 4. Point HDF5 to conda (needed for hdf5-sys):
$env:HDF5_DIR = "$env:CONDA_PREFIX\Library"
$env:HDF5_ROOT = "$env:CONDA_PREFIX\Library"
$env:PKG_CONFIG_PATH = "$env:CONDA_PREFIX\Library\lib\pkgconfig"
$env:PATH = "$env:CONDA_PREFIX\Library\bin;$env:PATH"
# Build
cargo build --workspace
# Package like CI (optional)
New-Item -ItemType Directory -Path dist -Force | Out-Null
Copy-Item target\release\orbitron-viewer.exe dist\
Copy-Item target\release\orbitron.exe dist\
Copy-Item target\release\orbitron-tui.exe dist\
$condaBin = Join-Path $env:CONDA_PREFIX "Library\bin"
$dllPatterns = @(
"hdf5*.dll","libhdf5*.dll","szip*.dll","zlib*.dll","libaec*.dll",
"libcrypto-*.dll","libssl-*.dll","libcurl-*.dll","libcurl.dll",
"libssh2.dll"
)
foreach ($pattern in $dllPatterns) {
Get-ChildItem -Path $condaBin -Filter $pattern -ErrorAction SilentlyContinue | `
Copy-Item -Destination dist -Force -ErrorAction SilentlyContinue
}
New-Item -ItemType Directory -Path dist\packages -Force | Out-Null
Compress-Archive -Path dist\* -DestinationPath dist\packages\orbitron-windows.zip -Force
# Option 2: Use vcpkg (recommended for system installs)
# 1. Install vcpkg: https://github.com/Microsoft/vcpkg
# 2. Install HDF5: vcpkg install hdf5:x64-windows
# 3. Set environment:
# set VCPKG_ROOT=<path-to-vcpkg>
# set HDF5_DIR=%VCPKG_ROOT%\installed\x64-windows
# Option 3: Use Docker (see §2.1)
# Option 4: See scripts/install-deps-windows.sh for more optionsTroubleshooting:
- HDF5 not found: Ensure
HDF5_DIRpoints to the HDF5 installation directory - pkg-config errors: Set
PKG_CONFIG_PATHto include HDF5’s pkgconfig directory - macOS library errors: Add HDF5 lib directory to
DYLD_LIBRARY_PATH
2.3 Conda Environment (Optional)
Best for: Users already using conda, HPC environments, Python bridge development
Why use conda: - ✅ Isolated environment (similar to Docker) - ✅ Good for scientific computing workflows - ✅ Useful for Python bridge development - ✅ Common in HPC environments - ✅ Environment variables automatically set via environment.yml
Note: This is optional. System packages or Docker are recommended for most users.
Setup:
Option 1: Using setup script (recommended):
# Creates environment from environment.yml and sets up activation scripts
./scripts/setup-conda-env.sh
# Activate the environment
conda activate orbitron-dev
# Environment variables (HDF5_DIR, PKG_CONFIG_PATH, DYLD_LIBRARY_PATH) are automatically set!
# Activation scripts properly expand ${CONDA_PREFIX} at activation time
# Build
cargo build --workspaceOption 2: Manual setup:
# Create environment from environment.yml
conda env create -f environment.yml
# Activate environment
conda activate orbitron-dev
# Set up activation scripts (one-time setup)
mkdir -p "${CONDA_PREFIX}/etc/conda/activate.d"
mkdir -p "${CONDA_PREFIX}/etc/conda/deactivate.d"
cp scripts/conda-activate.sh "${CONDA_PREFIX}/etc/conda/activate.d/orbitron-env.sh"
cp scripts/conda-deactivate.sh "${CONDA_PREFIX}/etc/conda/deactivate.d/orbitron-env.sh"
chmod +x "${CONDA_PREFIX}/etc/conda/activate.d/orbitron-env.sh"
chmod +x "${CONDA_PREFIX}/etc/conda/deactivate.d/orbitron-env.sh"
# Deactivate and reactivate to load environment variables
conda deactivate
conda activate orbitron-dev
# Build
cargo build --workspaceNote: - Activation scripts reliably expand ${CONDA_PREFIX} at activation time (unlike conda’s variables section which treats it as a literal) - Environment variables are automatically set when you activate the environment - no manual exports needed! - The environment.yml file defines packages; activation scripts handle environment variables
Customizing Environment Name:
ORBITRON_CONDA_ENV=myenv ./scripts/setup-conda-env.shFiles: - scripts/setup-conda-env.sh - Automated conda environment setup - environment.yml - Conda environment specification (if you want to create one)
Troubleshooting:
- Conda not found: Install Miniconda or Anaconda first
- Environment already exists: The script will prompt to recreate it
- Path issues: Always use
$CONDA_PREFIX, never hardcoded paths