branch-pad is an interactive Python notebook environment that enables branching experimentation and hypothesis testing. It allows researchers and developers to explore multiple approaches simultaneously while maintaining a clear history of their work.
Live Demo: https://alexyorke.github.io/branch-pad/ (takes a while to load)



- Click the "Branch" button on any cell to create two parallel branches
- Each branch inherits the parent's code and execution context
- Branches are visually connected to show relationships
- Each branch gets a unique color for easy identification
- Labels: Give each branch a meaningful name
- Descriptions: Add detailed notes about the branch's purpose
- Colors: Choose from multiple color themes for visual organization
- Collapsible View: Toggle branch visibility using the arrow button

- Each branch maintains its own Python execution context
- Changes in one branch don't affect others
- Automatic package detection and installation
- Real-time output display
- Click "Show Packages" to view installed packages
- Search functionality to find specific packages
- Automatic version tracking
- Package state is preserved per branch
- Click the "Create Snapshot" button on any branch
- Enter a label for the snapshot
- The snapshot captures:
- Code state
- Output
- Execution context
- Environment state
- Timestamp
- View all snapshots in chronological order
- Each snapshot shows:
- Label
- Creation timestamp
- Code preview
- "Restore" button to revert to any snapshot
- "Return to Current" to exit snapshot view
- Click "Compare Branches" to enter comparison mode
- Select up to two branches to compare
- View differences in:
- Code (with highlighted changes)
- Output
- Variables
- Execution context
- Side-by-side diff view
- Added/removed code highlighting
- Output comparison
- Variable state comparison
- Click "Export Notebook" to save the entire workspace
- Preserves all branches and their relationships
- Includes execution history and outputs
- Click "Export for Deployment" button
- Select the target branch
- Generates a ZIP file containing:
script.py
: Combined Python script from root to selected branchrequirements.txt
: All required packages with versionsDockerfile
: Ready-to-use container configurationREADME.md
: Setup and running instructions
-
Local Execution:
pip install -r requirements.txt python script.py
-
Docker Deployment:
docker build -t branch-pad-[branch-id] . docker run branch-pad-[branch-id]
- Visual representation of branch hierarchy
- Collapsible branches to manage complexity
- Branch count indicators
- Parent-child relationship lines
- Panning: Click and drag on the empty canvas to pan the view
- Zooming: Use mouse wheel or pinch gestures to zoom in and out
- Draggable Cells: Reposition cells by dragging them across the canvas
- Cell Deletion: Remove unwanted cells with delete confirmation dialog
- Increased Canvas Size: Larger workspace for complex branch arrangements
- Automatic dark mode detection
- Theme-aware UI components
- High contrast accessibility
-
Initial Setup
- The root branch is created automatically
- Enter your Python code in the code editor
- Click "Run" to execute the code
-
Creating Experiments
- Branch from any existing cell
- Label your branches meaningfully
- Add descriptions for context
- Use different colors for organization
-
Managing Versions
- Create snapshots at important points
- Use the comparison tool to track changes
- Export branches for deployment when ready
-
Branch Organization
- Use meaningful branch labels
- Add detailed descriptions
- Choose distinct colors for different experiments
- Collapse unused branches to reduce clutter
-
Version Control
- Create snapshots before major changes
- Use descriptive snapshot labels
- Compare branches to understand differences
- Export important versions for backup
-
Deployment
- Test exported scripts locally first
- Verify all dependencies are captured
- Use Docker for consistent environments
- Document any special requirements
- Built with Next.js and React
- Uses Pyodide for in-browser Python execution
- Supports Python 3.9+ features
- Real-time code execution and output
- Automatic package management
- Dark mode support
This project is configured for easy deployment to GitHub Pages. Here's how to deploy:
-
Push to GitHub: Push your code to a GitHub repository.
-
Enable GitHub Pages:
- Go to your repository on GitHub
- Navigate to Settings > Pages
- Under "Build and deployment", select "GitHub Actions" as the source
-
Automatic Deployment:
- The included GitHub Actions workflow will automatically build and deploy your site when you push to any branch
- Your site will be available at
https://[your-username].github.io/[repository-name]/
-
Demo Link:
- Once deployed, your project will be accessible at: https://[your-username].github.io/branch-pad/
- You can replace
[your-username]
with your actual GitHub username in this README - This link can be shared with others to showcase your project
-
Local Testing:
- Run
./run.ps1
to build the project with the correct base path - Use a static file server to test the output:
npx serve out
- Or use the provided test script:
./test-deploy.ps1
- Run
If your deployed site appears corrupted (HTML loads but CSS/JS doesn't):
-
Check Asset Paths: Make sure all assets are referenced with the correct base path. The configuration in
next.config.ts
includes:output: 'export'
- Enables static HTML exportbasePath
- Sets the base URL path for your siteassetPrefix
- Ensures assets are loaded with the correct pathtrailingSlash: true
- Ensures consistent URL handling
-
Test Locally: Use the
test-deploy.ps1
script to test your deployment locally before pushing to GitHub. -
Clear Cache: If you're still seeing issues after deployment, try clearing your browser cache or testing in an incognito window.
The deployment setup includes:
- Static export configuration in
next.config.ts
- Automatic base path detection for GitHub Pages
- GitHub Actions workflow for CI/CD
If you need to customize the deployment, you can modify:
.github/workflows/deploy.yml
for CI/CD settingsnext.config.ts
for Next.js export options