Thank you for contributing to this project! This guide will help you get started.
-
Install Prerequisites
macOS/Linux:
# Install uv curl -LsSf https://astral.sh/uv/install.sh | sh
Windows (PowerShell):
# Install uv powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
-
Clone and Install
The following commands work the same on all platforms:
git clone <repo-url> cd platform-engineering-template uv sync
-
Create a new branch
git checkout -b feature/your-feature-name
-
Make your changes
-
Run tests and checks
make test make lint make type-check -
Commit your changes
git add . git commit -m "Description of changes"
-
Push and create a pull request
git push origin feature/your-feature-name
This project uses:
- ruff for linting and formatting
- mypy for type checking
- pytest for testing
Before committing, ensure:
Using Make (macOS/Linux, or Windows with Make installed):
# Format code
make format
# Check linting
make lint
# Run type checking
make type-check
# Run tests
make testDirect commands (works on all platforms):
# Format code
uv run ruff format .
uv run ruff check --fix .
# Check linting
uv run ruff check .
# Run type checking
uv run mypy api/src cli/src
# Run tests
uv run pytest- Place API tests in
api/tests/ - Place CLI tests in
cli/tests/ - Follow the naming convention
test_*.py - Aim for high test coverage
- Write both unit and integration tests
Example test:
def test_example_function() -> None:
"""Test description."""
result = example_function()
assert result == expected_valueAll functions must have type hints:
def process_data(data: list[str]) -> dict[str, int]:
"""Process the data and return counts."""
return {item: len(item) for item in data}- Add docstrings to all public functions and classes
- Use Google-style docstrings
- Update README.md if adding new features
- Keep comments clear and concise
Example docstring:
def example_function(param: str) -> bool:
"""
Short description of the function.
Args:
param: Description of the parameter.
Returns:
Description of the return value.
Raises:
ValueError: When the parameter is invalid.
"""
pass- Title: Use clear, descriptive titles
- Description: Explain what and why
- Tests: Include tests for new functionality
- Documentation: Update docs as needed
- CI: Ensure all CI checks pass
- Tests pass locally
- Code is formatted with ruff
- Type checking passes with mypy
- Documentation is updated
- Commit messages are clear
- No merge conflicts
api/ - FastAPI application
src/api/ - Source code
tests/ - API tests
cli/ - Typer CLI application
src/cli/ - Source code
tests/ - CLI tests
macOS/Linux:
# Add to API
cd api && uv add <package>
# Add to CLI
cd cli && uv add <package>
# Add dev dependencies
uv add --dev <package>Windows (PowerShell):
# Add to API
cd api; uv add <package>
# Add to CLI
cd cli; uv add <package>
# Add dev dependencies
uv add --dev <package>Ensure you're in the correct directory when running commands:
macOS/Linux:
cd api && uv run pytest # For API tests
cd cli && uv run pytest # For CLI testsWindows (PowerShell):
cd api; uv run pytest # For API tests
cd cli; uv run pytest # For CLI testsMake sure all functions have type hints and pass mypy checks.
- Check existing issues
- Read the documentation
- Ask questions in discussions
- Create a pull request
- Wait for CI checks to pass
- Request review from maintainers
- Address feedback
- Merge after approval
Thank you for your contributions!