Skip to content
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

Use future annotations #459

Merged
merged 5 commits into from
Jan 4, 2025
Merged

Use future annotations #459

merged 5 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
Copy link

codecov bot commented Jan 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.11%. Comparing base (dd45294) to head (eb80806).
Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #459      +/-   ##
==========================================
- Coverage   84.33%   84.11%   -0.23%     
==========================================
  Files          16       16              
  Lines         932      919      -13     
  Branches      137      137              
==========================================
- Hits          786      773      -13     
  Misses         93       93              
  Partials       53       53              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

tony added 3 commits January 4, 2025 07:53
Fixed 134 errors:
- conftest.py:
     1 × TC003 (typing-only-standard-library-import)
     1 × I002 (missing-required-import)
- docs/conf.py:
     2 × UP037 (quoted-annotation)
     1 × I002 (missing-required-import)
     1 × I001 (unsorted-imports)
     1 × UP007 (non-pep604-annotation)
- scripts/generate_gitlab.py:
     1 × I001 (unsorted-imports)
     1 × TC001 (typing-only-first-party-import)
     1 × I002 (missing-required-import)
- src/vcspull/__about__.py:
     1 × I002 (missing-required-import)
- src/vcspull/__init__.py:
     1 × I001 (unsorted-imports)
     1 × I002 (missing-required-import)
- src/vcspull/_internal/config_reader.py:
     8 × UP037 (quoted-annotation)
     1 × I001 (unsorted-imports)
     1 × I002 (missing-required-import)
- src/vcspull/cli/__init__.py:
     2 × UP007 (non-pep604-annotation)
     1 × I002 (missing-required-import)
- src/vcspull/cli/sync.py:
     3 × TC003 (typing-only-standard-library-import)
     2 × UP007 (non-pep604-annotation)
     2 × TC002 (typing-only-third-party-import)
     1 × I002 (missing-required-import)
     1 × I001 (unsorted-imports)
- src/vcspull/config.py:
    17 × UP007 (non-pep604-annotation)
     8 × UP037 (quoted-annotation)
     1 × I002 (missing-required-import)
     1 × TC003 (typing-only-standard-library-import)
     1 × I001 (unsorted-imports)
- src/vcspull/exc.py:
     1 × I002 (missing-required-import)
- src/vcspull/log.py:
     1 × UP007 (non-pep604-annotation)
     1 × I002 (missing-required-import)
- src/vcspull/types.py:
     3 × UP007 (non-pep604-annotation)
     3 × TC002 (typing-only-third-party-import)
     1 × TC003 (typing-only-standard-library-import)
     1 × I002 (missing-required-import)
     1 × I001 (unsorted-imports)
- src/vcspull/util.py:
     1 × I002 (missing-required-import)
- src/vcspull/validator.py:
     1 × I002 (missing-required-import)
     1 × UP037 (quoted-annotation)
- tests/__init__.py:
     1 × I002 (missing-required-import)
- tests/fixtures/example.py:
     1 × I002 (missing-required-import)
     1 × UP037 (quoted-annotation)
- tests/helpers.py:
     1 × UP037 (quoted-annotation)
     1 × TC003 (typing-only-standard-library-import)
     1 × I002 (missing-required-import)
     1 × I001 (unsorted-imports)
     1 × PYI034 (non-self-return-type)
- tests/test_cli.py:
    24 × UP037 (quoted-annotation)
     1 × TC003 (typing-only-standard-library-import)
     1 × I002 (missing-required-import)
     1 × TC002 (typing-only-third-party-import)
     1 × I001 (unsorted-imports)
- tests/test_config.py:
     2 × UP037 (quoted-annotation)
     1 × I002 (missing-required-import)
     1 × UP007 (non-pep604-annotation)
     1 × TC003 (typing-only-standard-library-import)
     1 × I001 (unsorted-imports)
- tests/test_config_file.py:
     1 × I002 (missing-required-import)
- tests/test_repo.py:
     1 × I001 (unsorted-imports)
     1 × TC003 (typing-only-standard-library-import)
     1 × I002 (missing-required-import)
- tests/test_sync.py:
     1 × I002 (missing-required-import)
     1 × TC003 (typing-only-standard-library-import)
     1 × TC002 (typing-only-third-party-import)
     1 × I001 (unsorted-imports)
- tests/test_utils.py:
     3 × I001 (unsorted-imports)
     1 × TC003 (typing-only-standard-library-import)
     1 × I002 (missing-required-import)
     1 × TC002 (typing-only-third-party-import)

Found 460 errors (134 fixed, 326 remaining).
20 files reformatted, 5 files left unchanged

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 815643e to 240fbb0 Compare January 4, 2025 13:53
@tony tony force-pushed the future-annotations branch from 221ded1 to eb80806 Compare January 4, 2025 15:24
@tony tony merged commit 224f484 into master Jan 4, 2025
9 checks passed
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