This directory contains technical references and contribution guidelines for developers working on the lablink-paper-figures repository.
Technical reference for diagram styling, layout, and troubleshooting.
Topics covered:
- GraphViz DOT format basics
- Edge routing and constraint parameters
- Node and cluster styling
- Font and spacing presets
- Common layout issues and fixes
- Orthogonal splines (
splines="ortho") - Cross-cluster edge routing
Who needs this: Developers working on architecture diagrams, troubleshooting rendering issues
How to contribute to this repository.
Topics covered:
- Code style guidelines (Ruff, 88 char lines)
- Testing with pytest
- Adding new figures
- Documentation requirements
- Pull request process
- OpenSpec for change proposals
Who needs this: Anyone contributing code, figures, or documentation
- Formatter:
uv run ruff format . - Linter:
uv run ruff check . - Line length: 88 characters (Black-compatible)
- Type hints: Encouraged for function signatures
- Docstrings: Required for public functions (Google-style)
# Run all tests
uv run pytest
# Run with coverage
uv run pytest --cov=src --cov-report=term-missing
# Verbose output
uv run pytest -v- Explore in Jupyter notebook (
notebooks/exploratory/) - Extract reusable logic to
src/<domain>/module - Create plotting script in
scripts/plotting/plot_<figure>.py - Add data collection script if needed (
scripts/analysis/) - Document data sources in
data/raw/<dataset>/README.md - Generate with presets:
uv run python scripts/plotting/plot_<figure>.py --preset paper
- Commit final figures to
figures/main/and update main README - Document in
docs/figures/analysis-figures/<figure>.md
Required:
- Support
--preset {paper|poster|presentation}flag - Support
--format {png|pdf|svg|both}flag - Generate metadata
.txtfile with data sources - Use
uv runfor all Python execution - Default to
figures/main/orfigures/supplementary/
Presets:
paper: 14pt fonts, 300 DPI, ~6.5" widthposter: 20pt fonts, 300 DPI, ~12" widthpresentation: 16pt fonts, 150 DPI, 10"x7.5"
ALWAYS use uv (never pip, conda, or poetry):
# Add dependency
uv add <package>
# Add dev dependency
uv add --dev <package>
# Install/update environment
uv sync
# Install with dev tools
uv sync --all-extras
# Run command in environment
uv run <command>- Create feature branch:
git checkout -b feature-name - Make changes: Edit code, add tests, update docs
- Format and lint:
uv run ruff format . uv run ruff check .
- Test:
uv run pytest
- Commit:
git add . git commit -m "Descriptive message explaining why"
- Push and create PR:
git push origin feature-name # Create pull request on GitHub
For significant changes (new features, breaking changes, major refactors):
- Create proposal:
cd openspec # Follow openspec/AGENTS.md for proposal format
- Validate:
openspec validate <change-id> --strict
- Apply (after approval):
openspec apply <change-id>
See openspec/AGENTS.md for full details.
- Python 3.10+
- uv package manager
- graphviz system package
- (Optional) Access to lablink/lablink-template repos
# Clone repository
git clone https://github.com/talmolab/lablink-paper-figures.git
cd lablink-paper-figures
# Install dependencies with dev tools
uv sync --all-extras
# Verify installation
uv run pytest
uv run ruff check .# Clone LabLink repositories for architecture diagrams
cd ..
git clone https://github.com/talmolab/lablink-template.git
git clone https://github.com/talmolab/lablink.git
# Set environment variables
export LABLINK_TERRAFORM_DIR=../lablink-template/lablink-infrastructure
export LABLINK_CLIENT_VM_TERRAFORM_DIR=../lablink/packages/allocator/src/lablink_allocator_service/terraformlablink-paper-figures/
├── data/ # Data files
│ ├── raw/ # Original, immutable (gitignored except READMEs)
│ └── processed/ # Cleaned, transformed (some committed)
├── figures/ # Generated figures
│ ├── main/ # Main text (committed)
│ ├── supplementary/ # Supplementary (committed)
│ └── run_*/ # Timestamped (gitignored)
├── notebooks/ # Jupyter notebooks (exploratory)
├── scripts/
│ ├── analysis/ # Data collection and processing
│ └── plotting/ # Figure generation
├── src/ # Reusable modules
│ ├── diagram_gen/ # Infrastructure diagram logic
│ ├── terraform_parser/ # Terraform HCL parsing
│ ├── dependency_graph/ # Network analysis
│ └── gpu_costs/ # GPU pricing utilities
├── tests/ # Unit tests
├── docs/ # Documentation
│ ├── architecture/ # LabLink system analysis
│ ├── figures/ # Figure generation guides
│ └── development/ # This directory
└── openspec/ # Change management
├── changes/ # Change proposals
└── specs/ # Capability specifications
uv run pytest
uv run pytest -v # Verbose
uv run pytest tests/test_foo.py # Single file
uv run pytest -k test_bar # Single testuv run ruff check . # Lint
uv run ruff format . # Format
uv run ruff check --fix . # Auto-fix safe issuesuv run python scripts/plotting/generate_architecture_diagram.py \
--terraform-dir ../lablink-template/lablink-infrastructure \
--diagram-type main \
--verbose
# Outputs to timestamped run folder for reviewuv run python scripts/plotting/plot_gpu_cost_trends.py \
--preset paper \
--verbosepython -m cProfile -o profile.stats scripts/plotting/<script>.py
python -m pstats profile.statsuv add <new-package> # Add and install
uv sync # Update from pyproject.toml
git add pyproject.toml uv.lock
git commit -m "Add <package> dependency"Most scripts support --verbose or -v:
uv run python scripts/plotting/<script>.py --verboseSee GraphViz Reference for:
- Broken arrows / missing edges
- Overlapping text
- Layout problems
- Orthogonal routing issues
# Set GitHub token
export GITHUB_TOKEN=ghp_your_token_here
# Check remaining rate limit
curl -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/rate_limit# Check data directory READMEs
find data -name "README.md" -exec cat {} \;- Use cached data: Don't use
--force-refreshunless necessary - Profile slow code: Use
cProfileorline_profiler - Vectorize operations: Prefer NumPy/pandas over Python loops
- Batch API requests: Reduce network calls
- Document expected runtime: Add to script help text
- GraphViz Reference - Diagram troubleshooting
- Contributing Guide - Full contribution workflow
- Architecture Documentation - LabLink system analysis
- Main README.md - Repository overview
- uv documentation - Package manager
- Ruff documentation - Linter and formatter
- pytest documentation - Testing framework
- GraphViz documentation - Diagram rendering
- diagrams library - Python diagram generation