Skip to content

🔥 chore: remove PEP 563 future annotations#53

Merged
SigureMo merged 1 commit into
ShigureLab:mainfrom
ShigureNyako:codex/remove-pep-563
May 23, 2026
Merged

🔥 chore: remove PEP 563 future annotations#53
SigureMo merged 1 commit into
ShigureLab:mainfrom
ShigureNyako:codex/remove-pep-563

Conversation

@SigureMo
Copy link
Copy Markdown
Contributor

Summary

Remove from __future__ import annotations across the package and tests now that gh-llm requires Python 3.14.

Also remove the Ruff flake8-future-annotations selection and isort required-imports configuration so tooling no longer auto-adds the PEP 563 import.

Validation

  • uv run ruff format --check --diff .
  • uv run ty check --error-on-warning src/gh_llm tests
  • uv run ruff check .
  • uv run pytest

Remove postponed-annotation future imports now that the package requires Python 3.14. Also remove the Ruff/isort configuration that selected flake8-future-annotations and auto-added the import back.

Co-authored-by: Codex <noreply@openai.com>
@SigureMo SigureMo changed the title [codex] Remove PEP 563 future annotations 🔥 chore: remove PEP 563 future annotations May 23, 2026
@SigureMo SigureMo marked this pull request as ready for review May 23, 2026 17:22
Copilot AI review requested due to automatic review settings May 23, 2026 17:22
@SigureMo SigureMo merged commit e4f91f5 into ShigureLab:main May 23, 2026
4 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes from __future__ import annotations across the gh_llm package and tests, aligning the codebase and tooling with the project’s stated minimum Python version (3.14) and preventing automated re-introduction of the future import via Ruff/isort settings.

Changes:

  • Removed from __future__ import annotations from package modules and test files.
  • Updated Ruff configuration to stop selecting flake8-future-annotations (FA) and to stop auto-inserting the future import via isort required-imports.
  • Cleaned up __init__.py / __main__.py / CLI-related entrypoint files accordingly.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/test_pr_body.py Removes future-annotations import from test module.
tests/test_extension_entrypoint.py Removes future-annotations import from test module.
tests/test_command_options.py Removes future-annotations import from test module.
tests/test_cli.py Removes future-annotations import from test module.
src/gh_llm/render.py Removes future-annotations import; module relies heavily on annotated model types.
src/gh_llm/pr_body.py Removes future-annotations import.
src/gh_llm/pager.py Removes future-annotations import; contains TYPE_CHECKING-only imports used in annotations.
src/gh_llm/models.py Removes future-annotations import; contains TYPE_CHECKING-only imports used in annotations.
src/gh_llm/invocation.py Removes future-annotations import.
src/gh_llm/github_api.py Removes future-annotations import; has TYPE_CHECKING-only types used in annotations.
src/gh_llm/environment.py Removes future-annotations import; uses Sequence in annotations.
src/gh_llm/diagnostics.py Removes future-annotations import; uses Sequence in annotations.
src/gh_llm/commands/repo.py Removes future-annotations import; annotations reference TYPE_CHECKING-only model types.
src/gh_llm/commands/pr.py Removes future-annotations import; annotations reference TYPE_CHECKING-only model types.
src/gh_llm/commands/options.py Removes future-annotations import; annotations reference TYPE_CHECKING-only Callable.
src/gh_llm/commands/issue.py Removes future-annotations import; annotations reference TYPE_CHECKING-only model types.
src/gh_llm/commands/doctor.py Removes future-annotations import; annotations reference TYPE_CHECKING-only Any/Sequence.
src/gh_llm/commands/init.py Removes future-annotations import (file becomes empty).
src/gh_llm/cli.py Removes future-annotations import.
src/gh_llm/main.py Removes future-annotations import.
src/gh_llm/init.py Removes future-annotations import from package metadata module.
pyproject.toml Drops Ruff FA selection and removes config that auto-adds the future-annotations import.
Comments suppressed due to low confidence (6)

src/gh_llm/render.py:6

  • This module uses TimelineContext, TimelinePage, etc. in function annotations (e.g., def render_header(context: TimelineContext) -> list[str]:) but only imports them under TYPE_CHECKING. After dropping from __future__ import annotations, evaluating/accessing these annotations can raise NameError (e.g., via typing.get_type_hints). Import these model types at runtime (no circular dependency apparent here) or adjust annotations so evaluation succeeds.
import json
import re
import shlex
from datetime import UTC
from typing import TYPE_CHECKING, cast

src/gh_llm/commands/options.py:6

  • Callable is used in function annotations (e.g., resolver: Callable[[...], T]) but is only imported under TYPE_CHECKING. After removing from __future__ import annotations, evaluating/accessing annotations can raise NameError (e.g., via typing.get_type_hints). Import Callable from collections.abc at runtime (stdlib, low cost) or adjust annotations so evaluation succeeds.
import sys
from datetime import UTC, datetime
from difflib import get_close_matches
from pathlib import Path
from typing import TYPE_CHECKING, Any, NoReturn

src/gh_llm/commands/repo.py:8

  • This module’s function annotations reference RepoPreflight / RepoDocument, but those names are only imported under TYPE_CHECKING. With the future-annotations import removed, evaluating/accessing these annotations can raise NameError (e.g., via typing.get_type_hints). Import these model types at runtime or adjust annotations/import strategy so evaluation succeeds.
from typing import TYPE_CHECKING, Any

from gh_llm.github_api import GitHubClient
from gh_llm.invocation import display_command_with

if TYPE_CHECKING:
    from gh_llm.models import RepoDocument, RepoPreflight

src/gh_llm/commands/issue.py:6

  • This module uses TimelineContext / TimelinePage (and related types) in annotations but imports them only under TYPE_CHECKING. With from __future__ import annotations removed, evaluating/accessing these annotations can raise NameError (e.g., via typing.get_type_hints). Import the needed model types at runtime or adjust annotations/import strategy so evaluation succeeds.
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any

from gh_llm.commands.options import (
    add_auto_collapse_author_argument,
    add_body_input_arguments,

src/gh_llm/commands/pr.py:10

  • This file references multiple model types in annotations (e.g., PullRequestMeta, TimelineContext, TimelinePage, ReviewThreadSummary) but only imports them under TYPE_CHECKING. Now that from __future__ import annotations is removed, evaluating/accessing annotations can raise NameError (e.g., via typing.get_type_hints). Import these types at runtime (if no circular dependency) or adjust annotations/import strategy so evaluation succeeds.
import json
import os
import re
import shlex
import tempfile
from dataclasses import dataclass
from pathlib import Path
from typing import TYPE_CHECKING, Any

from gh_llm.commands.options import (

src/gh_llm/commands/doctor.py:12

  • Any and Sequence are used in annotations in this module (e.g., register_doctor_parser(subparsers: Any), _render_probe_lines(probes: Sequence[_ProbeResult])), but they’re only imported under TYPE_CHECKING. After removing from __future__ import annotations, evaluating/accessing annotations can raise NameError (e.g., via typing.get_type_hints). Import Any from typing and Sequence from collections.abc at runtime (recommended) or adjust annotations/import strategy so evaluation succeeds.
import json
import os
import shlex
import shutil
import subprocess
import sys
from dataclasses import dataclass
from pathlib import Path
from typing import TYPE_CHECKING, cast
from urllib.parse import SplitResult, urlsplit, urlunsplit

from gh_llm import __version__

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/gh_llm/models.py
Comment on lines 1 to 3
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, cast

Comment thread src/gh_llm/pager.py
Comment on lines 1 to 3
import math
from typing import TYPE_CHECKING

Comment thread src/gh_llm/environment.py
Comment on lines 1 to 3
import os
import shlex
from typing import TYPE_CHECKING
Comment thread src/gh_llm/diagnostics.py
Comment on lines 1 to 3
import shlex
from dataclasses import dataclass
from typing import TYPE_CHECKING
Comment thread src/gh_llm/github_api.py
Comment on lines 1 to 3
import base64
import binascii
import json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants