Skip to content

Migrate typing for core files #4500

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

Draft
wants to merge 1 commit into
base: potel-base
Choose a base branch
from
Draft

Migrate typing for core files #4500

wants to merge 1 commit into from

Conversation

sl0thentr0py
Copy link
Member

@sl0thentr0py sl0thentr0py commented Jun 20, 2025

extracted from https://github.com/getsentry/sentry-python/pull/4487/files with lots of manual fixes

  • migrate old style # type: bla to inline types
  • most importantly use __future__.annotations so that we can simply use forward annotations without wrapping them in strings like we did before, this simplifies things substantially
  • also guard only things that shouldn't be imported under TYPE_CHECKING, in the future it seems we should avoid using TYPE_CHECKING completely

@sl0thentr0py sl0thentr0py force-pushed the neel/typing branch 2 times, most recently from 193076c to 17827c2 Compare June 20, 2025 19:16
Copy link

codecov bot commented Jun 20, 2025

Codecov Report

Attention: Patch coverage is 98.71795% with 8 lines in your changes missing coverage. Please review.

Project coverage is 84.69%. Comparing base (6d622b2) to head (c458d9b).

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
sentry_sdk/transport.py 91.83% 3 Missing and 1 partial ⚠️
sentry_sdk/scope.py 98.29% 2 Missing ⚠️
sentry_sdk/_compat.py 80.00% 1 Missing ⚠️
sentry_sdk/utils.py 98.96% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff               @@
##           potel-base    #4500      +/-   ##
==============================================
+ Coverage       80.91%   84.69%   +3.78%     
==============================================
  Files             144      144              
  Lines           14821    14846      +25     
  Branches         2365     2367       +2     
==============================================
+ Hits            11992    12574     +582     
+ Misses           2109     1545     -564     
- Partials          720      727       +7     
Files with missing lines Coverage Δ
sentry_sdk/_init_implementation.py 100.00% <100.00%> (ø)
sentry_sdk/_log_batcher.py 79.76% <100.00%> (+0.24%) ⬆️
sentry_sdk/_lru_cache.py 100.00% <100.00%> (ø)
sentry_sdk/_queue.py 60.00% <100.00%> (ø)
sentry_sdk/_werkzeug.py 50.00% <100.00%> (+1.85%) ⬆️
sentry_sdk/api.py 96.55% <100.00%> (+0.04%) ⬆️
sentry_sdk/attachments.py 100.00% <100.00%> (ø)
sentry_sdk/client.py 84.88% <100.00%> (ø)
sentry_sdk/consts.py 99.59% <100.00%> (+<0.01%) ⬆️
sentry_sdk/debug.py 95.23% <100.00%> (+0.23%) ⬆️
... and 16 more

... and 17 files with indirect coverage changes

@sl0thentr0py sl0thentr0py force-pushed the neel/typing branch 9 times, most recently from f6d64a5 to 4b67774 Compare June 20, 2025 21:23
@@ -1,5 +1,4 @@
from opentelemetry.context import create_key
from sentry_sdk.tracing_utils import Baggage
Copy link
Member Author

Choose a reason for hiding this comment

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

this was creating an unnecessary circular dep

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