-
Notifications
You must be signed in to change notification settings - Fork 201
Open
Description
Summary
Update type annotations throughout the codebase to use Python 3.9+ built-in generics instead of typing module equivalents.
Changes needed
Replace deprecated typing imports with built-in types:
List[X]→list[X]Dict[K, V]→dict[K, V]Set[X]→set[X]Tuple[X, Y]→tuple[X, Y]Optional[X]→X | NoneUnion[X, Y]→X | YIterable,Generator→ import fromcollections.abc
Files affected
src/postgres_mcp/database_health/database_health.pysrc/postgres_mcp/index/index_opt_base.pysrc/postgres_mcp/index/presentation.pysrc/postgres_mcp/server.pysrc/postgres_mcp/sql/safe_sql.pytests/unit/index/test_dta_calc.pytests/unit/sql/test_sql_driver.pytests/utils.py
How to apply
Run:
uv run ruff check . --fix --unsafe-fixes
uv run ruff format .Cleanup required
After applying fixes, remove the following lint.ignore rules from pyproject.toml:
# TODO: Remove these ignores when fixing #129 (code modernization)
lint.ignore = [
"UP006", # Use `list` instead of `List` for type annotations
"UP035", # Import from `collections.abc` instead of `typing`
"UP045", # Use `X | None` instead of `Optional[X]`
"RUF059", # Unused unpacked variable
"RUF100", # Unused noqa directive
]Context
This was deferred during the dependency version bump (#130) to avoid breaking existing PRs with merge conflicts.
Metadata
Metadata
Assignees
Labels
No labels