Skip to content

Convert to PEP 695 type parameters and deprecate removed TypeVars + type aliases #8096

Open
jenshnielsen wants to merge 7 commits intomicrosoft:mainfrom
jenshnielsen:generic_cleanup
Open

Convert to PEP 695 type parameters and deprecate removed TypeVars + type aliases #8096
jenshnielsen wants to merge 7 commits intomicrosoft:mainfrom
jenshnielsen:generic_cleanup

Conversation

@jenshnielsen
Copy link
Copy Markdown
Collaborator

  • Convert 22 classes/functions to PEP 695 type parameter syntax (UP046/UP047)
  • Add noqa: UP046 with comments for 14 cases that require PEP 696 (TypeVar defaults), which needs Python 3.13+
  • Fix ruff autofix bug in Base_SPDT.py (TINSTR vs _TINSTR mismatch)
  • Clean up unused TypeVar definitions and imports across ~13 files
  • Add _make_deprecated_typevars_getattr helper in deprecate.py for module-level getattr deprecation warnings
  • Add deprecation warnings (QCoDeSDeprecationWarning) for 9 modules with removed public TypeVars, guarded by if not TYPE_CHECKING so type checkers still flag removed imports as errors
  • Add tests for the deprecation helper

@jenshnielsen jenshnielsen requested a review from a team as a code owner May 4, 2026 09:44
jenshnielsen added a commit to jenshnielsen/Qcodes that referenced this pull request May 4, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.86%. Comparing base (0a13dca) to head (c567894).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8096      +/-   ##
==========================================
+ Coverage   70.80%   70.86%   +0.06%     
==========================================
  Files         302      302              
  Lines       31911    31983      +72     
==========================================
+ Hits        22593    22665      +72     
  Misses       9318     9318              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

jenshnielsen added a commit to jenshnielsen/Qcodes that referenced this pull request May 4, 2026
Also deprecate 3 additional pre-existing unused TypeVars in
field_vector.py, threading.py, and channel.py. Fix pyright
errors in test_deprecate.py.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jenshnielsen added a commit to jenshnielsen/Qcodes that referenced this pull request May 4, 2026
Also deprecate 3 additional pre-existing unused TypeVars in
field_vector.py, threading.py, and channel.py. Fix pyright
errors in test_deprecate.py.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jenshnielsen and others added 3 commits May 4, 2026 13:42
- Convert 22 classes/functions to PEP 695 type parameter syntax (UP046/UP047)
- Add noqa: UP046 with comments for 14 cases that require PEP 696 (TypeVar
  defaults), which needs Python 3.13+
- Fix ruff autofix bug in Base_SPDT.py (TINSTR vs _TINSTR mismatch)
- Clean up unused TypeVar definitions and imports across ~13 files
- Add _make_deprecated_typevars_getattr helper in deprecate.py for
  module-level __getattr__ deprecation warnings
- Add deprecation warnings (QCoDeSDeprecationWarning) for 9 modules with
  removed public TypeVars, guarded by if not TYPE_CHECKING so type checkers
  still flag removed imports as errors
- Add tests for the deprecation helper

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Also deprecate 3 additional pre-existing unused TypeVars in
field_vector.py, threading.py, and channel.py. Fix pyright
errors in test_deprecate.py.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jenshnielsen and others added 2 commits May 5, 2026 06:58
Deprecate soft-deprecated type aliases in data_set_protocol.py
(scalar_res_types, values_type, res_type, setpoints_type,
array_like_types) and ats_api.py (int_or_param) using the same
__getattr__-based deprecation pattern used for TypeVars.

Also update the deprecation warning message to say 'name' instead
of 'TypeVar' since the helper is now used for type aliases too.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jenshnielsen jenshnielsen changed the title Convert to PEP 695 type parameters and deprecate removed TypeVars Convert to PEP 695 type parameters and deprecate removed TypeVars + type aliases May 5, 2026
Comment thread tests/common.py
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