Back to all reviewers

Standardize version transitions

fastapi/fastapi
Based on 3 comments
Python

When supporting multiple library versions or preparing for version deprecation in configuration-dependent code, use standardized TODO comments with consistent formatting. Always include a space after the # symbol and use the prefix "TODO:" to ensure comments can be found with standard search tools.

Configurations Python

Reviewer Prompt

When supporting multiple library versions or preparing for version deprecation in configuration-dependent code, use standardized TODO comments with consistent formatting. Always include a space after the # symbol and use the prefix “TODO:” to ensure comments can be found with standard search tools.

Example:

def pydantic_snapshot(
    *,
    v2: Snapshot,
    v1: Snapshot,  # TODO: remove v1 argument when deprecating Pydantic v1
):
    # Version-specific implementation
    if PYDANTIC_V2:
        return v2
    else:
        return v1

This practice helps teams track configuration-dependent code that will require updates during dependency upgrades, making version transitions smoother and more systematic. It also ensures that version-specific code paths are clearly documented and can be easily located when performing major configuration changes.

3
Comments Analyzed
Python
Primary Language
Configurations
Category

Source Discussions