Modernize type annotations for Python 3.10+
Author: omryCreated Sep 28, 2026Updated Sep 28, 2026
Hydra 1.4 supports Python 3.10–3.14, but parts of the codebase still use older annotation spellings such as typing.List, typing.Dict, typing.Optional, and typing.Union. Update annotations to Python 3.10-compatible forms where they are equivalent and clearer.
Scope
- Modernize annotations in Hydra core, bundled plugins, and their tests to use built-in generics and
X | Yunions where safe. Remove imports made unused by the changes. - Audit annotations inspected at runtime—particularly structured configs, dataclasses, OmegaConf integration, plugin interfaces, and serialization—before changing their spelling. Preserve behavior and runtime type information where it matters.
- Do not raise the minimum supported Python version or introduce 3.11+ syntax. Do not add
from __future__ import annotationswholesale or change public behavior as part of a mechanical cleanup. - Keep the change reviewable; it may be split into focused PRs by package.
Validation
Run the relevant tests and lint/type checks, including Python 3.10 and the newest supported Python version. Add regression coverage if a runtime-inspected annotation needs special treatment.
This is a typing/style modernization, not a user-facing API change.
Source: facebookresearch/hydra