CLI tool to automate git worktree and Docker Compose development workflows
Project description
sprout
A CLI tool to automate git worktree and Docker Compose development workflows.
Features
- 🌱 Create isolated development environments using git worktrees
- 🔧 Automatic
.envfile generation from templates - 🚢 Smart port allocation to avoid conflicts
- 📁 Centralized worktree management in
.sprout/directory - 🎨 Beautiful CLI interface with colors and tables
Installation
pip install sprout
For development:
# Clone the repository
git clone https://github.com/SecDev-Lab/sprout.git
cd sprout
# Install in development mode
pip install -e ".[dev]"
Quick Start
- Create a
.env.exampletemplate in your project root:
# API Configuration
API_KEY={{ API_KEY }}
API_PORT={{ auto_port() }}
# Database Configuration
DB_HOST=localhost
DB_PORT={{ auto_port() }}
# Example: Docker Compose variables (preserved as-is)
# sprout will NOT process ${...} syntax - it's passed through unchanged
# DB_NAME=${DB_NAME}
- Create a new development environment:
sprout create feature-branch
- Navigate to your new environment:
cd $(sprout path feature-branch)
- Start your services:
docker compose up -d
Commands
sprout create <branch-name>
Create a new development environment with automated setup.
sprout ls
List all managed development environments with their status.
sprout rm <branch-name>
Remove a development environment (with confirmation prompts).
sprout path <branch-name>
Get the filesystem path of a development environment.
sprout --version
Show the version of sprout.
Template Syntax
sprout supports two types of placeholders in .env.example:
-
Variable Placeholders:
{{ VARIABLE_NAME }}- First: Checks if the variable exists in your environment (e.g.,
export API_KEY=xxx) - Then: If not found in environment, prompts for user input
- Example:
{{ API_KEY }}will use$API_KEYif set, otherwise asks you to enter it
- First: Checks if the variable exists in your environment (e.g.,
-
Auto Port Assignment:
{{ auto_port() }}- Automatically assigns available ports
- Avoids conflicts with other sprout environments
- Checks system port availability
-
Docker Compose Syntax (Preserved):
${VARIABLE}- NOT processed by sprout - passed through as-is
- Useful for Docker Compose variable substitution
- Example:
${DB_NAME:-default}remains unchanged in generated.env
Environment Variable Resolution Example
# Set environment variable
export API_KEY="my-secret-key"
# Create sprout environment - API_KEY will be automatically used
sprout create feature-branch
# → API_KEY in .env will be set to "my-secret-key" without prompting
# For unset variables, sprout will prompt
sprout create another-branch
# → Enter a value for 'DATABASE_URL': [user input required]
Documentation
- Architecture Overview - Design philosophy, architecture, and implementation details
- Detailed Usage Guide - Comprehensive usage examples and troubleshooting
Development
Setup
# Install development dependencies
make setup
Testing
# Run tests
make test
# Run tests with coverage
make test-cov
Code Quality
# Run linter
make lint
# Format code
make format
# Run type checking
make typecheck
Requirements
- Python 3.11+
- Git
- Docker Compose (optional, for Docker-based workflows)
License
See LICENSE file.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sprout_cli-0.2.0.tar.gz.
File metadata
- Download URL: sprout_cli-0.2.0.tar.gz
- Upload date:
- Size: 13.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62fbc1d164ab0f58fac83a64041b688960e1ea191d513d48f7e6dd62b3d8ee96
|
|
| MD5 |
f9bf689f608bc77a629cc3d86b958c53
|
|
| BLAKE2b-256 |
3cd7d9314c80efc164c90d2d3f33c58b164a2ef772390cb392fd67c883d05e16
|
File details
Details for the file sprout_cli-0.2.0-py3-none-any.whl.
File metadata
- Download URL: sprout_cli-0.2.0-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e21444a04aa7dff21d25ca47ae39a76573f4cb696b7a30032d06e67c786c6340
|
|
| MD5 |
9949f2b4f8af3df55db26e9d8ccd6eb5
|
|
| BLAKE2b-256 |
3a83a32286f4228762471cff1a6ba07548353bc12a4b865e0f32f2d2ca4437ea
|