Skip to content

Style Guide¤

To maintain a consistent, readable, and high-quality codebase, all contributions to crewmaster must adhere to the following style guidelines.

Type Hinting¤

We use Python's built-in type system extensively. All function signatures and class attributes should be annotated with type hints. This improves code readability, enables static analysis, and provides better IDE support with autocompletion.

Example:

from typing import List

def get_agents(team_name: str) -> List[AgentBase]:
    """Retrieves a list of agents for a given team."""
    # ... function logic ...

Docstrings¤

All public functions, classes, and methods must be documented using the Google Docstring Style. This standard provides a clear and consistent format for explaining the purpose, arguments, and return values of your code.

Example:

def calculate_expression(expression: str) -> float:
    """Calculates the result of a mathematical expression.

    Args:
        expression: The mathematical expression to evaluate, e.g., "2 + 2 * 3".

    Returns:
        The result of the calculation.
    """
    # ... function logic ...

Code Formatting¤

We use an automated code formatter (like black or ruff) to ensure a consistent style across the entire repository. Before submitting a pull request, please ensure your code is formatted correctly.

Naming Conventions¤

  • Variables and Functions: snake_case (e.g., my_variable, calculate_result).
  • Classes: PascalCase (e.g., MyClass, AgentBase).
  • Constants: UPPER_CASE (e.g., MAX_RETRIES).