Skip to content

Conversation

@Repiteo
Copy link
Contributor

@Repiteo Repiteo commented Nov 24, 2024

In hindsight, applying a static boilerplate to all Python files was far too excessive. It turns out there is full support for gradually integrating modern type-hint syntax via FA1 instead. As such, this PR only integrates from __future__ import annotations on the files that can take immediate advantage of it:

# Before
from typing import List, Optional, Tuple, Union

def some_function(env: "ForwardDeclaredType") -> Optional[Tuple[List[str], Union[int, float]]]:

# After
from __future__ import annotations

def some_function(env: ForwardDeclaredType) -> tuple[list[str], int | float]] | None:

Footnotes

  1. https://docs.astral.sh/ruff/rules/#flake8-future-annotations-fa

• Expand Ruff linter to catch & upgrade legacy type-hint syntax
@Repiteo Repiteo force-pushed the scons/future-annotations-minimal branch from 4353e9b to 11fc998 Compare November 22, 2025 19:23
Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine.

@Repiteo Repiteo modified the milestones: 4.x, 4.6 Nov 22, 2025
@Repiteo Repiteo merged commit 48887b3 into godotengine:master Nov 24, 2025
20 checks passed
@Repiteo Repiteo deleted the scons/future-annotations-minimal branch November 24, 2025 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants