Skip to content

Next Python SDK major - #5005

Draft
sentrivana wants to merge 55 commits into
masterfrom
major/3.0
Draft

Next Python SDK major#5005
sentrivana wants to merge 55 commits into
masterfrom
major/3.0

Conversation

@sentrivana

@sentrivana sentrivana commented Oct 24, 2025

Copy link
Copy Markdown
Contributor

We're preparing our next major on this branch.

The project is tracked in Linear. If you don't have access, we'll try to tag issues belonging to the project with the SDK 3.0 label on GitHub so that you can follow along.

Context

You might have read this announcement about us discontinuing work on a 3.0. This is referring to the work done on the potel-base branch, which included two types of changes: a huge refactor of our tracing code on the one hand, and various unrelated changes, improvements and fixes on the other. We're dropping the huge refactor part, and only porting the rest, to a new branch and eventually a new 3.0 release.

Changes

@codecov

codecov Bot commented Oct 24, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.76%. Comparing base (14aff96) to head (d864ba0).
⚠️ Report is 4 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #5005       +/-   ##
===========================================
+ Coverage   70.55%   83.76%   +13.21%     
===========================================
  Files         180      180               
  Lines       18077    18080        +3     
  Branches     3008     3009        +1     
===========================================
+ Hits        12754    15145     +2391     
+ Misses       4432     1943     -2489     
- Partials      891      992      +101     
Files with missing lines Coverage Δ
sentry_sdk/integrations/__init__.py 88.42% <100.00%> (+0.37%) ⬆️

... and 61 files with indirect coverage changes

@github-actions

github-actions Bot commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

92713 passed | ❌ 1 failed | ⏭️ 5195 skipped | Total: 97909 | Pass Rate: 94.69% | Execution Time: 336m 34s

📊 Comparison with Base Branch

Metric Change
Total Tests 📉 -7728
Passed Tests 📉 -6444
Failed Tests
Skipped Tests 📉 -1284

➕ New Tests (1)

View new tests
  • test_streaming_chat_completion[True-False-True-False]
    • File: tests.integrations.litellm.test_litellm
    • Status: ❌ Failing

➖ Removed Tests (1)

View removed tests
  • test_continuous_profiler_auto_start_and_stop_sampled_span_streaming[non-experiment-thread]
    • File: tests.profiler.test_continuous_profiler

❌ Failed Tests

test_streaming_chat_completion[True-False-True-False]

File: tests.integrations.litellm.test_litellm
Suite: py3.10-litellm-v1.95.0
Error: pytest.PytestUnraisableExceptionWarning: Exception ignored in thread started by: <bound method Thread._bootstrap of <Thread(ThreadPoolExecutor-21_3, started 140330506524224)>> Enable tracemalloc to get traceback where the object was allocated. See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

Stack Trace
/usr/lib/python3.10/threading.py:973: in _bootstrap
    self._bootstrap_inner()
/usr/lib/python3.10/threading.py:1011: in _bootstrap_inner
    _sys.settrace(_trace_hook)
E   RuntimeError: Cannot install a trace function while another trace function is being installed

The above exception was the direct cause of the following exception:
.tox/py3.10-litellm-v1.95.0/lib/python3.10/site-packages/_pytest/runner.py:361: in from_call
    result: TResult | None = func()
.tox/py3.10-litellm-v1.95.0/lib/python3.10/site-packages/_pytest/runner.py:250: in <lambda>
    lambda: runtest_hook(item=item, **kwds),
.tox/py3.10-litellm-v1.95.0/lib/python3.10/site-packages/pluggy/_hooks.py:512: in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
.tox/py3.10-litellm-v1.95.0/lib/python3.10/site-packages/pluggy/_manager.py:120: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
.tox/py3.10-litellm-v1.95.0/lib/python3.10/site-packages/_pytest/logging.py:865: in pytest_runtest_call
    yield
.tox/py3.10-litellm-v1.95.0/lib/python3.10/site-packages/pluggy/_callers.py:53: in run_old_style_hookwrapper
    return result.get_result()
.tox/py3.10-litellm-v1.95.0/lib/python3.10/site-packages/pluggy/_callers.py:38: in run_old_style_hookwrapper
    res = yield
.tox/py3.10-litellm-v1.95.0/lib/python3.10/site-packages/_pytest/capture.py:900: in pytest_runtest_call
    return (yield)
.tox/py3.10-litellm-v1.95.0/lib/python3.10/site-packages/_pytest/skipping.py:268: in pytest_runtest_call
    return (yield)
.tox/py3.10-litellm-v1.95.0/lib/python3.10/site-packages/_pytest/unraisableexception.py:183: in pytest_runtest_call
    collect_unraisable(item.config)
.tox/py3.10-litellm-v1.95.0/lib/python3.10/site-packages/_pytest/unraisableexception.py:79: in collect_unraisable
    raise errors[0]
.tox/py3.10-litellm-v1.95.0/lib/python3.10/site-packages/_pytest/unraisableexception.py:67: in collect_unraisable
    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
E   pytest.PytestUnraisableExceptionWarning: Exception ignored in thread started by: <bound method Thread._bootstrap of <Thread(ThreadPoolExecutor-21_3, started 140330506524224)>>
E   Enable tracemalloc to get traceback where the object was allocated.
E   See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

✅ Patch coverage is 91.69%. Project has 2285 uncovered lines.
✅ Project coverage is 90.31%. Comparing base (base) to head (head).

Files with missing lines (11)
File Patch % Lines
sentry_sdk/integrations/aws_lambda.py 0.00% ⚠️ 13 Missing
sentry_sdk/integrations/otlp.py 86.67% ⚠️ 4 Missing and 4 partials
sentry_sdk/_init_implementation.py 88.89% ⚠️ 2 Missing and 2 partials
sentry_sdk/client.py 71.43% ⚠️ 2 Missing
sentry_sdk/integrations/django/transactions.py 71.43% ⚠️ 2 Missing
sentry_sdk/integrations/pure_eval.py 33.33% ⚠️ 2 Missing
sentry_sdk/integrations/asyncio.py 66.67% ⚠️ 1 Missing
sentry_sdk/integrations/chalice.py 87.50% ⚠️ 1 Missing
sentry_sdk/integrations/flask.py 50.00% ⚠️ 1 Missing
sentry_sdk/integrations/starlette.py 83.33% ⚠️ 1 Missing
sentry_sdk/profiler/continuous_profiler.py 50.00% ⚠️ 1 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    89.99%    90.31%    +0.32%
==========================================
  Files          193       185        -8
  Lines        24946     23593     -1353
  Branches      9000      8552      -448
==========================================
+ Hits         22451     21308     -1143
- Misses        2495      2285      -210
- Partials      1435      1381       -54

Generated by Codecov Action

@github-actions

github-actions Bot commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (logging) Separate ignore lists for events/breadcrumbs and sentry logs by sl0thentr0py in #5698

Bug Fixes 🐛

Anthropic

  • Set exception info on streaming span when applicable by alexander-alderman-webb in #5683
  • Patch AsyncStream.close() and AsyncMessageStream.close() to finish spans by alexander-alderman-webb in #5675
  • Patch Stream.close() and MessageStream.close() to finish spans by alexander-alderman-webb in #5674

Documentation 📚

  • Add note on AI PRs to CONTRIBUTING.md by sentrivana in #5696

Internal Changes 🔧

  • Add -latest alias for each integration test suite by sentrivana in #5706
  • Use date-based branch names for toxgen PRs by sentrivana in #5704
  • 🤖 Update test matrix with new releases (03/19) by github-actions in #5703
  • Add client report tests for span streaming by sentrivana in #5677

Other

  • Next Python SDK major by sentrivana in #5005
  • Update CHANGELOG.md by sentrivana in #5685

🤖 This preview updates automatically when you update the PR.

Comment thread sentry_sdk/consts.py
sentrivana and others added 4 commits July 28, 2026 11:47
Add `UnraisablehookIntegration` to the default integrations list.
Stop raising exceptions `from None` in the ASGI and asyncio integrations.

Closes #5624
Remove everything hub related, including all sorts of compatibility
shims around hubs/scopes.

Also remove deprecated session methods.

`configure_scope` and `push_scope` removal coming in a future PR.

#### Issues
Closes #5001
The integration requires additional configuration which should be
intentional on the user's part.

#### Issues
Closes #4993
- Remove everything in `integrations/opentelemetry`
(`SentrySpanProcessor`, `SentryPropagator`, etc.)
- Remove associated test files and CI config
- Move old propagator functions and consts that we were using in
`OTLPIntegration` to the OTLP propagator directly
- Remove `instrumenter`

Note: `NoOpSpan` was not removed because it makes mypy blow up. Not
worth the effort as we'll anyway get rid of it when dropping transaction
based tracing.

#### Issues
Closes #6932
Comment thread sentry_sdk/integrations/otlp.py
### Description
The API is deprecated and slated for removal in 3.0.

#### Issues
Closes #5019

#### Reminders
- Please add tests to validate your changes, and lint your code using
`uv run ruff`.
- Add GH Issue ID _&_ Linear ID (if applicable)
- PR title should use [conventional
commit](https://develop.sentry.dev/engineering-practices/commit-messages/#type)
style (`feat:`, `fix:`, `ref:`, `meta:`)
- For external contributors:
[CONTRIBUTING.md](https://github.com/getsentry/sentry-python/blob/master/CONTRIBUTING.md),
[Sentry SDK development docs](https://develop.sentry.dev/sdk/), [Discord
community](https://discord.gg/Ww9hbqr)
### Description
Remove the deprecated API.

#### Issues
Closes #5018
…new major (#6948)

### Description
When `failed_request_status_codes` was first introduced, it accepted a
different format. The format was then changed, while the old format was
deprecated. Drop support for the old format now.

#### Issues
Closes #5017
### Description
Most of the entries in our extras list serve as a way to
communicate/enforce the lower boundary of the respective framework that
we support. This creates a parallel system to the version checks we
already have in each integration.

Some extras, however, define extra dependencies or specific extras that
are required for an integration to work correctly (e.g. the Flask
integration needs `blinker` to work properly). In that case, keep the
extra.

#### Issues
Closes #6259
Comment thread tests/integrations/django/asgi/test_asgi.py
Comment thread sentry_sdk/integrations/launchdarkly.py Outdated
Comment thread sentry_sdk/scope.py
### Description
The LaunchDarkly client is a
[singleton](https://launchdarkly.com/docs/sdk/server-side/python#initialize-the-client).
As such, it doesn't make sense to provide a way to patch a specific
client only.

This allows us to get rid of the integation `__init__`, which is always
good: integrations are meant to be setup via `setup_once`.

#### Issues
Closes #7040

#### Reminders
- Please add tests to validate your changes, and lint your code using
`uv run ruff`.
- Add GH Issue ID _&_ Linear ID (if applicable)
- PR title should use [conventional
commit](https://develop.sentry.dev/engineering-practices/commit-messages/#type)
style (`feat:`, `fix:`, `ref:`, `meta:`)
- For external contributors:
[CONTRIBUTING.md](https://github.com/getsentry/sentry-python/blob/master/CONTRIBUTING.md),
[Sentry SDK development docs](https://develop.sentry.dev/sdk/), [Discord
community](https://discord.gg/Ww9hbqr)
- drop old chalice from ci
- bump min version in `integrations/__init__.py`
We're now enforcing Tornado > 6, so compat code for older versions is
not needed anymore
Comment thread sentry_sdk/integrations/trytond.py
Comment thread sentry_sdk/integrations/chalice.py
Comment thread sentry_sdk/integrations/openai_agents/__init__.py
Comment thread sentry_sdk/integrations/pydantic_ai/__init__.py
Comment thread sentry_sdk/integrations/spark/spark_driver.py
Comment thread tests/integrations/launchdarkly/test_launchdarkly.py
Comment thread sentry_sdk/integrations/__init__.py Outdated
Comment thread sentry_sdk/integrations/openai_agents/__init__.py
Comment thread sentry_sdk/integrations/starlette.py
Fixes for things that the bots
[surfaced](#5005) on the
major branch:
- some version checks were too late (after patching)
- fix TrytondWSGI integration name/`_MIN_VERSIONS` entry mismatch

Also, changed the warning of the `DidNotEnable` message from "X not
installed" to "X not installed or incompatible".
Strawberry is not auto-enabling in 3.0 anymore, so this guard is not
necessary.
### Description
Remove the `@ai_track` decorator and associated tests

#### Issues
Part of #6894
### Description
The actual compat code was removed with the contextvars shim. Just test
utils remain.

#### Issues
Closes #4997
Drop support for redis-py<[4.2](https://pypi.org/project/redis/4.2.0/):
- remove redis cluster legacy (it was moved directly into redis-py in
4.1)
- remove deprecated `max_data_size` integration option
- remove conditional patching of async client and pipeline -- just patch
always (they're available from 4.2+)
- use the Redis class instead of StrictRedis (which is just an alias)
### Description
- drop experimental options if they have a top-level replacement
- remove `start_profile_session` and `stop_profile_session` (replaced by
`start_profile` and `stop_profile`)


There is a `continuous_profiling_auto_start` experimental option without
a top-level replacement. There's also a
`try_autostart_continuous_profiler` function that says it should be
deprecated in favor of "auto lifecycle". There is no auto lifecycle as
far as I can tell. Or is this referring to `lifecycle=trace`? Leaving
this as is for now...

#### Issues
Closes #6946
- Remove `skipif`s that are not necessary anymore (because they skip
running the test case against framework versions we've now dropped)
- Remove flaky skipped threading test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants