Thank you for your interest in contributing to Swarmline!
# Clone the repository
git clone https://github.com/fockus/swarmline.git
cd swarmline
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # or .venv\Scripts\activate on Windows
# Install with dev dependencies and all extras
pip install -e ".[dev,all]"
# Verify installation
python -c "import swarmline; print(swarmline.__version__)"# All offline tests (default)
pytest
# Include tests that require Claude Agent SDK
pytest -m "requires_claude_sdk or not requires_claude_sdk"
# Include live/network tests
pytest -m live
# With coverage
pytest --cov=swarmline --cov-report=term-missing
# Specific test file
pytest tests/unit/test_agent_tool.py -vWe use Ruff for linting and formatting:
# Check
ruff check src/ tests/
ruff format --check src/ tests/
# Auto-fix
ruff check --fix src/ tests/
ruff format src/ tests/Type checking with ty:
ty check src/swarmline/- Clean Architecture — dependencies point inward: Infrastructure -> Application -> Domain
- Protocol-first — define
Protocolinterfaces before implementations - TDD — write tests before implementation (Red -> Green -> Refactor)
- SOLID — SRP (<300 lines per module), ISP (<=5 methods per protocol), DIP (depend on abstractions)
- Domain-agnostic — swarmline must not contain any domain-specific logic (finance, medical, etc.)
- Fork the repository
- Create a feature branch:
git checkout -b feat/my-feature - Write tests first (TDD)
- Implement the feature
- Ensure all tests pass:
pytest - Ensure code style:
ruff check && ruff format --check - Submit a pull request with a clear description
Follow Conventional Commits:
feat: add new middleware for rate limiting
fix: handle empty tool parameters in @tool decorator
docs: update runtime switching guide
test: add integration tests for SQLite provider
refactor: extract common logic from runtime ports
Swarmline uses optional dependency groups. When adding features that require new packages:
- Add the dependency to the appropriate extra in
pyproject.toml - Use lazy imports (inside functions/methods) for optional packages
- Never import optional packages at module top-level
- Add a smoke test in
tests/unit/test_import_isolation.py - Mark tests that require the extra with the appropriate marker:
@pytest.mark.requires_claude_sdk@pytest.mark.requires_anthropic@pytest.mark.requires_langchain@pytest.mark.live(for network-dependent tests)
Open an issue on GitHub for questions, bug reports, or feature requests.