sentry-python icon indicating copy to clipboard operation
sentry-python copied to clipboard

[vibe in progress] Migrate to inline type annotations

Open sl0thentr0py opened this issue 6 months ago • 1 comments

The codebase was migrated from comment-based to inline type annotations following PEP 484. This involved:

  • Core SDK files: sentry_sdk/session.py, sentry_sdk/feature_flags.py, sentry_sdk/_lru_cache.py, sentry_sdk/_werkzeug.py, sentry_sdk/logger.py, sentry_sdk/worker.py, sentry_sdk/scrubber.py, sentry_sdk/monitor.py, sentry_sdk/_log_batcher.py, sentry_sdk/client.py, and sentry_sdk/tracing.py were fully migrated. sentry_sdk/serializer.py was intentionally skipped due to its complexity.
  • Integration files: 16 major integration files were migrated, including sentry_sdk/integrations/trytond.py, sentry_sdk/integrations/typer.py, sentry_sdk/integrations/statsig.py, sentry_sdk/integrations/unleash.py, sentry_sdk/integrations/serverless.py, sentry_sdk/integrations/socket.py, sentry_sdk/integrations/atexit.py, sentry_sdk/integrations/pure_eval.py, sentry_sdk/integrations/graphene.py, sentry_sdk/integrations/fastapi.py, sentry_sdk/integrations/chalice.py, sentry_sdk/integrations/quart.py, sentry_sdk/integrations/beam.py, sentry_sdk/integrations/langchain.py, sentry_sdk/integrations/asgi.py, sentry_sdk/integrations/flask.py, and sentry_sdk/integrations/aws_lambda.py.
  • Migration tooling: scripts/migrate_type_annotations.py was created for automated conversions and analysis. MIGRATION_GUIDE.md and MIGRATION_STATUS.md were added for documentation and progress tracking.
  • Correction: An initial unintended functional change in sentry_sdk/feature_flags.py was reverted to ensure strict adherence to type annotation migration.

The changes standardize type hinting, improving IDE support, type safety, and developer experience across the core SDK and key integrations.

sl0thentr0py avatar Jun 17 '25 14:06 sl0thentr0py

:x: 1 Tests Failed:

Tests completed Failed Passed Skipped
24083 1 24082 5575
View the top 1 failed test(s) by shortest run time
tests.integrations.logging.test_logging::test_logging_captured_warnings
Stack Traces | 0.044s run time
.../integrations/logging/test_logging.py:262: in test_logging_captured_warnings
    assert len(recwarn) == 1
E   assert 2 == 1
E    +  where 2 = len(WarningsRecorder(record=True))

To view more test analytics, go to the Test Analytics Dashboard 📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

codecov[bot] avatar Jun 17 '25 15:06 codecov[bot]