Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: getsentry/sentry-python
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.24.0
Choose a base ref
...
head repository: getsentry/sentry-python
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2.24.1
Choose a head ref
  • 11 commits
  • 17 files changed
  • 9 contributors

Commits on Mar 21, 2025

  1. meta: Add CODEOWNERS (#4182)

    Ref #4183
    sentrivana authored Mar 21, 2025
    Copy the full SHA
    c295047 View commit details
  2. ci: Move mypy config into pyproject.toml (#4181)

    First step to consolidate configuration into `pyproject.toml`.
    
    ---------
    
    Co-authored-by: Daniel Szoke <7881302+szokeasaurusrex@users.noreply.github.com>
    antonpirker and szokeasaurusrex authored Mar 21, 2025
    Copy the full SHA
    8ad0d01 View commit details
  3. feat(profiling): add platform header to the chunk item-type in the en…

    …velope (#4178)
    
    We need to send the platform as part of the headers in the chunk
    item-type as this is the header that relay is checking to manage rate
    limiting.
    viglia authored Mar 21, 2025
    Copy the full SHA
    ce9d784 View commit details
  4. ci: Move pytest config into pyproject.toml (#4184)

    Consolidate configuration into `pyproject.toml`.
    antonpirker authored Mar 21, 2025
    Copy the full SHA
    aefa34d View commit details
  5. Merge branch 'release/2.24.0'

    getsentry-bot committed Mar 21, 2025
    Copy the full SHA
    b7f4a96 View commit details
  6. ci: Move flake8 config into pyproject.toml (#4185)

    Consolidate configuration into `pyproject.toml`.
    antonpirker authored Mar 21, 2025
    Copy the full SHA
    f8ec572 View commit details

Commits on Mar 24, 2025

  1. Broader except in django parsed_body (#4189)

    We are seeing internal errors in the Sentry SDK if `self.request.data`
    fails. Specifically, it recently failed with
    `rest_framework.exceptions.UnsupportedMediaType: Unsupported media type
    "" in request.`.
    
    This exception should not prevent sentry from reporting the original
    error.
    
    Similar to a previous fix I made
    #4001
    orhanhenrik authored Mar 24, 2025
    Copy the full SHA
    4fbcbf0 View commit details
  2. fix: Always set _spotlight_url (#4186)

    The conditional early exit in `SpotlightMiddleware` may cause attribute access errors when trying to check if `_spotlight_url` is set or not. This patch sets it to `None` explicitly at class level.
    BYK authored Mar 24, 2025
    Copy the full SHA
    fafe8f6 View commit details
  3. build(deps): bump actions/create-github-app-token from 1.11.6 to 1.11…

    ….7 (#4188)
    
    Bumps
    [actions/create-github-app-token](https://github.com/actions/create-github-app-token)
    from 1.11.6 to 1.11.7.
    <details>
    <summary>Release notes</summary>
    <p><em>Sourced from <a
    href="https://github.com/actions/create-github-app-token/releases">actions/create-github-app-token's
    releases</a>.</em></p>
    <blockquote>
    <h2>v1.11.7</h2>
    <h2><a
    href="https://github.com/actions/create-github-app-token/compare/v1.11.6...v1.11.7">1.11.7</a>
    (2025-03-20)</h2>
    <h3>Bug Fixes</h3>
    <ul>
    <li><strong>deps:</strong> bump undici from 5.28.4 to 7.5.0 (<a
    href="https://redirect.github.com/actions/create-github-app-token/issues/214">#214</a>)
    (<a
    href="https://github.com/actions/create-github-app-token/commit/a24b46a4626bf0f67abb297b82d863218920d5e2">a24b46a</a>)</li>
    </ul>
    </blockquote>
    </details>
    <details>
    <summary>Commits</summary>
    <ul>
    <li><a
    href="https://github.com/actions/create-github-app-token/commit/af35edadc00be37caa72ed9f3e6d5f7801bfdf09"><code>af35eda</code></a>
    build(release): 1.11.7 [skip ci]</li>
    <li><a
    href="https://github.com/actions/create-github-app-token/commit/a24b46a4626bf0f67abb297b82d863218920d5e2"><code>a24b46a</code></a>
    fix(deps): bump undici from 5.28.4 to 7.5.0 (<a
    href="https://redirect.github.com/actions/create-github-app-token/issues/214">#214</a>)</li>
    <li>See full diff in <a
    href="https://github.com/actions/create-github-app-token/compare/21cfef2b496dd8ef5b904c159339626a10ad380e...af35edadc00be37caa72ed9f3e6d5f7801bfdf09">compare
    view</a></li>
    </ul>
    </details>
    <br />
    
    
    [![Dependabot compatibility
    score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/create-github-app-token&package-manager=github_actions&previous-version=1.11.6&new-version=1.11.7)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
    
    Dependabot will resolve any conflicts with this PR as long as you don't
    alter it yourself. You can also trigger a rebase manually by commenting
    `@dependabot rebase`.
    
    [//]: # (dependabot-automerge-start)
    [//]: # (dependabot-automerge-end)
    
    ---
    
    <details>
    <summary>Dependabot commands and options</summary>
    <br />
    
    You can trigger Dependabot actions by commenting on this PR:
    - `@dependabot rebase` will rebase this PR
    - `@dependabot recreate` will recreate this PR, overwriting any edits
    that have been made to it
    - `@dependabot merge` will merge this PR after your CI passes on it
    - `@dependabot squash and merge` will squash and merge this PR after
    your CI passes on it
    - `@dependabot cancel merge` will cancel a previously requested merge
    and block automerging
    - `@dependabot reopen` will reopen this PR if it is closed
    - `@dependabot close` will close this PR and stop Dependabot recreating
    it. You can achieve the same result by closing it manually
    - `@dependabot show <dependency name> ignore conditions` will show all
    of the ignore conditions of the specified dependency
    - `@dependabot ignore this major version` will close this PR and stop
    Dependabot creating any more for this major version (unless you reopen
    the PR or upgrade to it yourself)
    - `@dependabot ignore this minor version` will close this PR and stop
    Dependabot creating any more for this minor version (unless you reopen
    the PR or upgrade to it yourself)
    - `@dependabot ignore this dependency` will close this PR and stop
    Dependabot creating any more for this dependency (unless you reopen the
    PR or upgrade to it yourself)
    
    
    </details>
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Mar 24, 2025
    Copy the full SHA
    2d8ae87 View commit details
  4. release: 2.24.1

    getsentry-bot committed Mar 24, 2025
    Copy the full SHA
    44238c5 View commit details
  5. Update CHANGELOG.md

    sentrivana authored Mar 24, 2025
    Copy the full SHA
    f60cc78 View commit details
21 changes: 0 additions & 21 deletions .flake8

This file was deleted.

1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @getsentry/owners-python-sdk
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ jobs:
steps:
- name: Get auth token
id: token
uses: actions/create-github-app-token@21cfef2b496dd8ef5b904c159339626a10ad380e # v1.11.6
uses: actions/create-github-app-token@af35edadc00be37caa72ed9f3e6d5f7801bfdf09 # v1.11.7
with:
app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }}
private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }}
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 2.24.1

### Various fixes & improvements

- Always set `_spotlight_url` (#4186) by @BYK
- Broader except in Django `parsed_body` (#4189) by @orhanhenrik
- Add platform header to the `chunk` item-type in the envelope (#4178) by @viglia
- Move `mypy` config into `pyproject.toml` (#4181) by @antonpirker
- Move `flake8` config into `pyproject.toml` (#4185) by @antonpirker
- Move `pytest` config into `pyproject.toml` (#4184) by @antonpirker
- Bump `actions/create-github-app-token` from `1.11.6` to `1.11.7` (#4188) by @dependabot
- Add `CODEOWNERS` (#4182) by @sentrivana

## 2.24.0

### Various fixes & improvements
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@
copyright = "2019-{}, Sentry Team and Contributors".format(datetime.now().year)
author = "Sentry Team and Contributors"

release = "2.24.0"
release = "2.24.1"
version = ".".join(release.split(".")[:2]) # The short X.Y version.


84 changes: 0 additions & 84 deletions mypy.ini

This file was deleted.

191 changes: 190 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#
# Tool: Black
#

[tool.black]
# 'extend-exclude' excludes files or directories in addition to the defaults
extend-exclude = '''
@@ -9,6 +13,11 @@ extend-exclude = '''
)
'''


#
# Tool: Coverage
#

[tool.coverage.run]
branch = true
omit = [
@@ -20,4 +29,184 @@ omit = [
[tool.coverage.report]
exclude_also = [
"if TYPE_CHECKING:",
]
]

#
# Tool: Pytest
#

[tool.pytest.ini_options]
addopts = "-vvv -rfEs -s --durations=5 --cov=./sentry_sdk --cov-branch --cov-report= --tb=short --junitxml=.junitxml"
asyncio_mode = "strict"
asyncio_default_fixture_loop_scope = "function"
markers = [
"tests_internal_exceptions: Handle internal exceptions just as the SDK does, to test it. (Otherwise internal exceptions are recorded and reraised.)",
]

[tool.pytest-watch]
verbose = true
nobeep = true

#
# Tool: Mypy
#

[tool.mypy]
allow_redefinition = true
check_untyped_defs = true
disallow_any_generics = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
no_implicit_optional = true
python_version = "3.11"
strict_equality = true
strict_optional = true
warn_redundant_casts = true
warn_unused_configs = true
warn_unused_ignores = true

# Relaxations for code written before mypy was introduced
# Do not use wildcards in module paths, otherwise added modules will
# automatically have the same set of relaxed rules as the rest
[[tool.mypy.overrides]]
module = "cohere.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "django.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "pyramid.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "psycopg2.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "pytest.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "aiohttp.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "anthropic.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "sanic.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "tornado.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "fakeredis.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "rq.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "pyspark.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "asgiref.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "langchain_core.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "executing.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "asttokens.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "pure_eval.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "blinker.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "sentry_sdk._queue"
ignore_missing_imports = true
disallow_untyped_defs = false

[[tool.mypy.overrides]]
module = "sentry_sdk._lru_cache"
disallow_untyped_defs = false

[[tool.mypy.overrides]]
module = "celery.app.trace"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "flask.signals"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "huey.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "openai.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "openfeature.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "huggingface_hub.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "arq.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "grpc.*"
ignore_missing_imports = true

#
# Tool: Flake8
#

[tool.flake8]
extend-ignore = [
# Handled by black (Whitespace before ':' -- handled by black)
"E203",
# Handled by black (Line too long)
"E501",
# Sometimes not possible due to execution order (Module level import is not at top of file)
"E402",
# I don't care (Do not assign a lambda expression, use a def)
"E731",
# does not apply to Python 2 (redundant exception types by flake8-bugbear)
"B014",
# I don't care (Lowercase imported as non-lowercase by pep8-naming)
"N812",
# is a worse version of and conflicts with B902 (first argument of a classmethod should be named cls)
"N804",
]
extend-exclude = ["checkouts", "lol*"]
exclude = [
# gRCP generated files
"grpc_test_service_pb2.py",
"grpc_test_service_pb2_grpc.py",
]
12 changes: 0 additions & 12 deletions pytest.ini

This file was deleted.

3 changes: 2 additions & 1 deletion requirements-devenv.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
-r requirements-linting.txt
-r requirements-testing.txt
mockupdb # required by `pymongo` tests that are enabled by `pymongo` from linter requirements
pytest
pytest>=6.0.0
tomli;python_version<"3.11" # Only needed for pytest on Python < 3.11
pytest-asyncio
7 changes: 4 additions & 3 deletions requirements-linting.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
mypy
black
flake8==5.0.4 # flake8 depends on pyflakes>=3.0.0 and this dropped support for Python 2 "# type:" comments
flake8==5.0.4
flake8-pyproject # Flake8 plugin to support configuration in pyproject.toml
flake8-bugbear # Flake8 plugin
pep8-naming # Flake8 plugin
types-certifi
types-protobuf
types-gevent
@@ -11,8 +14,6 @@ types-webob
opentelemetry-distro
pymongo # There is no separate types module.
loguru # There is no separate types module.
flake8-bugbear
pep8-naming
pre-commit # local linting
httpcore
launchdarkly-server-sdk
3 changes: 2 additions & 1 deletion requirements-testing.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pip
pytest
pytest>=6.0.0
tomli;python_version<"3.11" # Only needed for pytest on Python < 3.11
pytest-cov
pytest-forked
pytest-localserver
2 changes: 1 addition & 1 deletion sentry_sdk/consts.py
Original file line number Diff line number Diff line change
@@ -965,4 +965,4 @@ def _get_default_options():
del _get_default_options


VERSION = "2.24.0"
VERSION = "2.24.1"
6 changes: 5 additions & 1 deletion sentry_sdk/envelope.py
Original file line number Diff line number Diff line change
@@ -79,7 +79,11 @@ def add_profile_chunk(
):
# type: (...) -> None
self.add_item(
Item(payload=PayloadRef(json=profile_chunk), type="profile_chunk")
Item(
payload=PayloadRef(json=profile_chunk),
type="profile_chunk",
headers={"platform": profile_chunk.get("platform", "python")},
)
)

def add_checkin(
2 changes: 1 addition & 1 deletion sentry_sdk/integrations/django/__init__.py
Original file line number Diff line number Diff line change
@@ -584,7 +584,7 @@ def parsed_body(self):
# type: () -> Optional[Dict[str, Any]]
try:
return self.request.data
except AttributeError:
except Exception:
return RequestExtractor.parsed_body(self)


5 changes: 3 additions & 2 deletions sentry_sdk/spotlight.py
Original file line number Diff line number Diff line change
@@ -82,6 +82,7 @@ def capture_envelope(self, envelope):

class SpotlightMiddleware(MiddlewareMixin): # type: ignore[misc]
_spotlight_script = None # type: Optional[str]
_spotlight_url = None # type: Optional[str]

def __init__(self, get_response):
# type: (Self, Callable[..., HttpResponse]) -> None
@@ -103,7 +104,7 @@ def __init__(self, get_response):
@property
def spotlight_script(self):
# type: (Self) -> Optional[str]
if self._spotlight_script is None:
if self._spotlight_url is not None and self._spotlight_script is None:
try:
spotlight_js_url = urllib.parse.urljoin(
self._spotlight_url, SPOTLIGHT_JS_ENTRY_PATH
@@ -173,7 +174,7 @@ def process_response(self, _request, response):

def process_exception(self, _request, exception):
# type: (Self, HttpRequest, Exception) -> Optional[HttpResponseServerError]
if not settings.DEBUG:
if not settings.DEBUG or not self._spotlight_url:
return None

try:
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ def get_file_text(file_name):

setup(
name="sentry-sdk",
version="2.24.0",
version="2.24.1",
author="Sentry Team and Contributors",
author_email="hello@sentry.io",
url="https://github.com/getsentry/sentry-python",
21 changes: 13 additions & 8 deletions tests/profiler/test_continuous_profiler.py
Original file line number Diff line number Diff line change
@@ -141,6 +141,11 @@ def assert_single_transaction_with_profile_chunks(
if max_chunks is not None:
assert len(items["profile_chunk"]) <= max_chunks

for chunk_item in items["profile_chunk"]:
chunk = chunk_item.payload.json
headers = chunk_item.headers
assert chunk["platform"] == headers["platform"]

transaction = items["transaction"][0].payload.json

trace_context = transaction["contexts"]["trace"]
@@ -215,12 +220,12 @@ def assert_single_transaction_without_profile_chunks(envelopes):
pytest.param(
start_profile_session,
stop_profile_session,
id="start_profile_session/stop_profile_session",
id="start_profile_session/stop_profile_session (deprecated)",
),
pytest.param(
start_profiler,
stop_profiler,
id="start_profiler/stop_profiler (deprecated)",
id="start_profiler/stop_profiler",
),
],
)
@@ -292,12 +297,12 @@ def test_continuous_profiler_auto_start_and_manual_stop(
pytest.param(
start_profile_session,
stop_profile_session,
id="start_profile_session/stop_profile_session",
id="start_profile_session/stop_profile_session (deprecated)",
),
pytest.param(
start_profiler,
stop_profiler,
id="start_profiler/stop_profiler (deprecated)",
id="start_profiler/stop_profiler",
),
],
)
@@ -374,12 +379,12 @@ def test_continuous_profiler_manual_start_and_stop_sampled(
pytest.param(
start_profile_session,
stop_profile_session,
id="start_profile_session/stop_profile_session",
id="start_profile_session/stop_profile_session (deprecated)",
),
pytest.param(
start_profiler,
stop_profiler,
id="start_profiler/stop_profiler (deprecated)",
id="start_profiler/stop_profiler",
),
],
)
@@ -544,12 +549,12 @@ def test_continuous_profiler_auto_start_and_stop_unsampled(
pytest.param(
start_profile_session,
stop_profile_session,
id="start_profile_session/stop_profile_session",
id="start_profile_session/stop_profile_session (deprecated)",
),
pytest.param(
start_profiler,
stop_profiler,
id="start_profiler/stop_profiler (deprecated)",
id="start_profiler/stop_profiler",
),
],
)