git clone https://github.com/jmcentire/baton.git
cd baton
pip install -e ".[dev]"
pytest
src/baton/
schemas.py # Pydantic v2 models
config.py # YAML config loader
cli.py # CLI entry point
circuit.py # Graph operations (pure functions)
adapter.py # Async reverse proxy
adapter_control.py # Management API endpoints
routing.py # Pre-baked routing patterns
lifecycle.py # Circuit lifecycle orchestration
custodian.py # Health monitoring + self-healing
mock.py # Mock server generation from specs
collapse.py # Collapse algorithm
manifest.py # Service manifest loading
registry.py # Circuit derivation from manifests
compat.py # Static compatibility analysis
process.py # Subprocess management
state.py # .baton/ persistence
providers/ # Deployment backends
local.py # Local process deployment
gcp.py # GCP Cloud Run deployment
- Python 3.12+
- Pydantic v2 for all data models
- Frozen models for topology definitions, mutable for runtime state
- All async operations use asyncio (no external server frameworks)
- One test file per source module
- pytest with pytest-asyncio (
asyncio_mode = "auto")
- Pure functions for graph operations (circuit.py returns new CircuitSpec instances)
pytest # all tests
pytest tests/test_cli.py # specific module
pytest -v # verbose output
- Create
src/baton/providers/yourprovider.py
- Implement the
DeploymentProvider protocol:
async def deploy(circuit, target) -> CircuitState
async def teardown(circuit, target) -> None
async def status(circuit, target) -> CircuitState
- Register in
src/baton/providers/__init__.py
- Add tests in
tests/test_providers.py
- Add optional dependencies in
pyproject.toml
- Fork the repository
- Create a feature branch
- Write tests for new functionality
- Ensure all tests pass (
pytest)
- Submit a pull request