Skip to content

Use future annotations #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 4, 2025
Merged

Use future annotations #34

merged 4 commits into from
Jan 4, 2025

Conversation

tony
Copy link
Member

@tony tony commented Jan 4, 2025

Changes

chore: Support PEP 563 from __future__ import annotations

Using PEP 563's deferred resolution of annotations avoids the computation cost of symbols we imported solely used for type-checking.

Ruff:

PEP 563: https://peps.python.org/pep-0563/

@tony tony changed the title pyproject: Use future annotations Use future annotations Jan 4, 2025
tony added 2 commits January 4, 2025 07:52
Fixed 20 errors:
- conftest.py:
    1 × I002 (missing-required-import)
- docs/conf.py:
    2 × UP007 (non-pep604-annotation)
    2 × UP037 (quoted-annotation)
    1 × I002 (missing-required-import)
- src/g/__about__.py:
    1 × I002 (missing-required-import)
- src/g/__init__.py:
    4 × UP007 (non-pep604-annotation)
    3 × UP037 (quoted-annotation)
    1 × I002 (missing-required-import)
- tests/test_cli.py:
    3 × UP007 (non-pep604-annotation)
    1 × TC003 (typing-only-standard-library-import)
    1 × I002 (missing-required-import)

Found 58 errors (20 fixed, 38 remaining).
5 files reformatted

uv run ruff check --select ALL . --fix --unsafe-fixes --preview --show-fixes; uv run ruff format .
@tony tony force-pushed the future-annotations branch from 473236c to 1f2cc8f Compare January 4, 2025 13:52
@tony tony merged commit a471e15 into master Jan 4, 2025
8 checks passed
@tony tony deleted the future-annotations branch January 4, 2025 15:29
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.

1 participant