Skip to content

fix: conditional Self import depending on python version - #111

Merged
GitBib merged 1 commit into
GitBib:masterfrom
mdaubie:bugfix/110/typing-extensions-import
May 1, 2026
Merged

fix: conditional Self import depending on python version#111
GitBib merged 1 commit into
GitBib:masterfrom
mdaubie:bugfix/110/typing-extensions-import

Conversation

@mdaubie

@mdaubie mdaubie commented May 1, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #110

Notes

Tested for:

  • Python 3.10:
    uv run --no-dev --python 3.10 python -c "import pymkv"
  • Python 3.11:
    uv run --no-dev --python 3.11 python -c "import pymkv"

I don't think we can implement actual tests because typing-extension is always present in dev runtimes.
Could use dedicated tools though, like deptry.

from typing in >=3.11, else from typing_extensions, added as <3.11 dependency

@GitBib GitBib left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for the quick fix! Verified the bug reproduces on Python 3.10 with a no-dev install and that this PR resolves it on both 3.10 (typing-extensions installed via marker) and 3.11+ (uses stdlib typing.Self, no extra dep).

@codecov

codecov Bot commented May 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.11%. Comparing base (a9d20cf) to head (adc55d1).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #111   +/-   ##
=======================================
  Coverage   99.11%   99.11%           
=======================================
  Files          21       21           
  Lines        1472     1475    +3     
=======================================
+ Hits         1459     1462    +3     
  Misses         13       13           

☔ 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.

@GitBib GitBib mentioned this pull request May 1, 2026
2 tasks
@GitBib
GitBib merged commit 850316d into GitBib:master May 1, 2026
18 checks passed
@GitBib GitBib mentioned this pull request May 1, 2026
2 tasks
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.

typing_extensions import error in runtime-only

2 participants