Thanks for your interest in contributing to retrocode! This guide covers setup, development workflows, and our development practices.
- Python 3.10+
- Git
- Rust (for CLI tool compilation)
-
Clone the repository
git clone https://github.com/yourusername/retrocode.git cd retrocode -
Install dependencies with uv
# Install runtime dependencies uv pip install -e . # Install dev dependencies (includes zuban, ruff, etc.) uv pip install -e ".[dev]"
-
Install git hooks
# Use prek (7x faster than pre-commit) uv tool install prek prek install # Alternatively, use standard pre-commit # uv pip install pre-commit # pre-commit install
This project uses modern Rust-based tools for faster development feedback.
Ty is an extremely fast type checker implemented in Rust by Astral (creators of Ruff).
Run type checking locally:
# Check source code
uvx ty check src/
# Check tests
uvx ty check tests/
# Check both
uvx ty check src/ tests/Features:
- Mypy-compatible configuration (uses existing
[tool.mypy]in pyproject.toml) - Blazingly fast performance (Rust-based)
- Integrates seamlessly with Ruff (same team)
- Uses uvx for convenient invocation
Note: Ty is enabled in pre-commit hooks. Run it locally to check before committing.
Ruff is a fast Python linter and formatter that replaces multiple traditional tools.
Auto-format code:
ruff format src/ tests/Check for linting issues:
ruff check src/ tests/Auto-fix common issues:
ruff check --fix src/ tests/Prek is a Rust-based pre-commit hook framework that's 7x faster than the original.
Run all hooks:
prek run --all-filesRun specific hook:
prek run ruff
prek run ruff-formatUpdate hooks:
prek updateFallback to standard pre-commit (if needed):
# If you prefer the original pre-commit tool
pre-commit install
pre-commit run --all-files-
Auto-format your code
ruff format src/ tests/
-
Check for linting issues
ruff check --fix src/ tests/
-
Run type checking (optional but recommended)
zuban mypy src/ tests/
-
Run tests
pytest tests/
# The following runs automatically:
# - ruff format (fixes formatting)
# - ruff check (checks style)
# - documentation link validation
git commit -m "Your commit message"If hooks fail, they'll tell you what to fix. After fixing, stage the changes and try again.
# Run all tests
pytest
# Run with coverage
pytest --cov=src/retrocode tests/
# Run specific test file
pytest tests/test_agent.py
# Run with verbose output
pytest -v
# Run in parallel for faster feedback
pytest -n auto- Follow PEP 8 (enforced by ruff)
- Use type annotations (enforced by mypy/zuban configuration)
- Write docstrings for all public functions and classes
- Keep lines under 100 characters (ruff configured at 100)
Example:
def process_data(data: dict[str, Any]) -> dict[str, str]:
"""Process input data and return formatted output.
Args:
data: Dictionary containing raw input data
Returns:
Dictionary with formatted key-value pairs
"""
return {k: str(v) for k, v in data.items()}-
Create a branch
git checkout -b feature/your-feature-name
-
Make your changes with appropriate commits
-
Push and create PR
git push origin feature/your-feature-name
-
Ensure CI passes - GitHub Actions will run:
- Ruff formatting check
- Type checking
- Tests
- Documentation validation
-
Address review comments - iterate until approved
-
Merge - maintainers will merge to main
Install prek:
uv tool install prekTy is invoked via uvx, which should work automatically. If you encounter issues, you can install it globally:
uv tool install ty
ty check src/Run the failing tool to see what's wrong:
# If ruff fails
ruff check src/
ruff format src/
# If ty fails (optional)
uvx ty check src/Most errors can be auto-fixed:
ruff check --fix src/ tests/
ruff format src/ tests/- Make sure you're using the correct Python version
- Try running tests with pytest directly:
pytest tests/ - Check that dependencies are up to date:
uv pip install -e ".[dev]"
- Use prek instead of pre-commit - It's much faster
- Format with ruff instead of black - It's faster and more capable
- Type-check with ty instead of mypy - It's dramatically faster
- Run pytest with
-n auto- Parallel test execution is faster
See .retrocode/ for information about the test system configuration and custom Docker environments.
- Check existing GitHub issues
- Ask in our discussions
- See
.retrocode/DOCKERFILE_GUIDE.mdfor Docker/sandbox questions
By contributing, you agree that your contributions will be licensed under the same license as the project (see LICENSE file).
Thanks for contributing! 🎉