Hi family,
While reviewing the codebase for Apollo, I noticed several usages of typing.Dict, typing.List, etc., for example:
from typing import Optional, Any, Dict
The project specifies: [pyproject.toml] python = “3.11.*”
So since Python ≥3.9 (PEP 585), built-in collection types support generic annotations directly:
-
dict[str, Any]instead ofDict[str, Any] -
list[int]instead ofList[int]
additionally, Ruff flags this with rule UP035 (deprecated import from typing).
Proposal
We replace deprecated typing generics with modern built-in generics across the codebase.
Currently we are doing it like this;
from typing import Dict
def fn(x: Dict[str, Any]) → Optional[str]:
the proposed one is like this;
def fn(x: dict[str, Any]) → str | None:
Why This Matters
-
Aligns with modern Python typing standards (PEP 585)
-
Removes deprecated
typingimports -
Reduces dependency on legacy constructs
-
Matches Ruff’s recommended style
-
No runtime impact (typing-only change)
-
Safe given Python 3.11 requirement
Have a look at;
Python Software Foundation – PEP 585
This would be a non-functional refactor (no behavior change), focused purely on type annotations.
I’m happy to work on this if it aligns with the project’s style preferences.