Skip to content

Commit a112e2f

Browse files
committed
Merge branch 'master' into major/3.0
2 parents 86b2e98 + 7c90371 commit a112e2f

28 files changed

Lines changed: 3986 additions & 3730 deletions

‎.github/workflows/test-integrations-mcp.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
python-version: ["3.10","3.13","3.14","3.14t","3.15","3.15t"]
20+
python-version: ["3.10","3.11","3.13","3.14","3.14t","3.15","3.15t"]
2121
os: [ubuntu-22.04]
2222
env:
2323
# 3.7 runs in the python:X.Y container; tell uv to use that system Python.

‎scripts/aws/aws-attach-layer-to-lambda-function.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ echo "Getting ARN of newest Sentry lambda layer..."
2222
LAYER_ARN=$(aws lambda list-layer-versions --layer-name SentryPythonServerlessSDK-local-dev --query "LayerVersions[0].LayerVersionArn" | tr -d '"')
2323
echo "Done getting ARN of newest Sentry lambda layer $LAYER_ARN."
2424

25-
echo "Attaching Lamba layer to function $FUNCTION_NAME..."
25+
echo "Attaching Lambda layer to function $FUNCTION_NAME..."
2626
echo "Warning: This remove all other layers!"
2727
aws lambda update-function-configuration \
2828
--function-name "$FUNCTION_NAME" \
2929
--layers "$LAYER_ARN" \
3030
--no-cli-pager
31-
echo "Done attaching Lamba layer to function '$FUNCTION_NAME'."
31+
echo "Done attaching Lambda layer to function '$FUNCTION_NAME'."
3232

3333
echo "All done. Have a nice day!"

‎scripts/build_aws_lambda_layer.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def install_python_packages(self) -> None:
5656
"pip",
5757
"install",
5858
"--no-cache-dir", # always access PyPI
59-
"--no-deps", # the right depencencies have been installed in the call above
59+
"--no-deps", # the right dependencies have been installed in the call above
6060
"--quiet",
6161
sentry_python_sdk,
6262
"--target",

‎scripts/find_raise_from_none.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ def main():
4343
scan_file(module_path)
4444

4545
raise_from_none_count = {
46-
file: len(occurences)
47-
for file, occurences in RaiseFromNoneVisitor.line_numbers.items()
46+
file: len(occurrences)
47+
for file, occurrences in RaiseFromNoneVisitor.line_numbers.items()
4848
}
4949
if raise_from_none_count:
5050
exc = Exception("Detected unexpected raise ... from None.")

‎scripts/init_serverless_sdk.py‎

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
'sentry_sdk.integrations.init_serverless_sdk.sentry_lambda_handler'
77
"""
88

9+
import importlib
910
import os
10-
import re
11-
import sys
1211
from typing import TYPE_CHECKING
1312

1413
import sentry_sdk
@@ -27,8 +26,6 @@
2726

2827

2928
class AWSLambdaModuleLoader:
30-
DIR_PATH_REGEX = r"^(.+)\/([^\/]+)$"
31-
3229
def __init__(self, sentry_initial_handler):
3330
try:
3431
module_path, self.handler_name = sentry_initial_handler.rsplit(".", 1)
@@ -41,35 +38,24 @@ def extract_and_load_lambda_function_module(self, module_path):
4138
"""
4239
Method that extracts and loads lambda function module from module_path
4340
"""
44-
py_version = sys.version_info
45-
46-
if re.match(self.DIR_PATH_REGEX, module_path):
47-
# With a path like -> `scheduler/scheduler/event`
48-
# `module_name` is `event`, and `module_file_path` is `scheduler/scheduler/event.py`
49-
module_name = module_path.split(os.path.sep)[-1]
50-
module_file_path = module_path + ".py"
51-
52-
# Supported python versions are 3.7, 3.8
53-
if py_version >= (3, 7):
54-
import importlib.util
55-
56-
spec = importlib.util.spec_from_file_location(
57-
module_name, module_file_path
58-
)
59-
self.lambda_function_module = importlib.util.module_from_spec(spec)
60-
spec.loader.exec_module(self.lambda_function_module)
61-
else:
62-
raise ValueError("Python version %s is not supported." % py_version)
63-
else:
64-
import importlib
65-
66-
self.lambda_function_module = importlib.import_module(module_path)
41+
# the handler used to be loaded from a file path, so keep accepting
42+
# `./dir/file` and absolute `<task root>/dir/file` by making them relative
43+
# to the task root, which is on `sys.path`.
44+
task_root = os.environ.get("LAMBDA_TASK_ROOT", os.getcwd())
45+
module_path = os.path.relpath(os.path.join(task_root, module_path), task_root)
46+
47+
# like the Lambda runtime: `dir/file` is the module `dir.file`, which `sys.modules`
48+
# keeps, so its code only runs on the first invocation.
49+
# https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/fa2462d93d11da632aad8f8bfb07a3e060438150/awslambdaric/bootstrap.py#L53
50+
self.lambda_function_module = importlib.import_module(
51+
module_path.replace("/", ".")
52+
)
6753

6854
def get_lambda_handler(self):
6955
return getattr(self.lambda_function_module, self.handler_name)
7056

7157

72-
def sentry_lambda_handler(event: "Any", context: "Any") -> None:
58+
def sentry_lambda_handler(event: "Any", context: "Any") -> "Any":
7359
"""
7460
Handler function that invokes a lambda handler which path is defined in
7561
environment variables as "SENTRY_INITIAL_HANDLER"

‎scripts/populate_tox/config.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@
440440
},
441441
"redis": {
442442
"package": "redis",
443+
"include": "!=8.2.0b1",
443444
"deps": {
444445
"*": ["fakeredis!=1.7.4", "pytest<8.0.0", "pytest-asyncio"],
445446
">=4.0,<5.0": ["fakeredis<2.31.0"],

‎scripts/populate_tox/package_dependencies.jsonl‎

Lines changed: 233 additions & 118 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎scripts/populate_tox/populate_tox.py‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def fetch_package_dependencies(
212212
print(f" Resolving dependencies: {package}=={version} on Python {python_version}")
213213

214214
# Removing non-report output with -qqq may be brittle, but avoids file I/O.
215-
# Currently -qqq supresses all non-report output that would break json.loads().
215+
# Currently -qqq suppresses all non-report output that would break json.loads().
216216
result = subprocess.run(
217217
[
218218
"uv",
@@ -1327,6 +1327,11 @@ def main() -> dict[str, list]:
13271327

13281328
write_tox_file(packages)
13291329

1330+
# Unused cache entries are only pruned on full runs. With --only/--skip,
1331+
# skipped integrations don't touch (most of) their cache entries, so pruning
1332+
# would wipe them.
1333+
prune_cache = not (only_update or skip_update)
1334+
13301335
# Sort the release cache file
13311336
releases = []
13321337
with open(RELEASES_CACHE_FILE) as releases_cache:
@@ -1335,7 +1340,8 @@ def main() -> dict[str, list]:
13351340
with open(RELEASES_CACHE_FILE, "w") as releases_cache:
13361341
for release in releases:
13371342
if (
1338-
CACHE[_normalize_name(release["info"]["name"])][
1343+
not prune_cache
1344+
or CACHE[_normalize_name(release["info"]["name"])][
13391345
release["info"]["version"]
13401346
]["_accessed"]
13411347
is True
@@ -1350,7 +1356,8 @@ def main() -> dict[str, list]:
13501356
with open(DEPENDENCIES_CACHE_FILE, "w") as releases_cache:
13511357
for release in releases:
13521358
if (
1353-
DEPENDENCIES_CACHE[release["python_version"]][
1359+
not prune_cache
1360+
or DEPENDENCIES_CACHE[release["python_version"]][
13541361
release["install_targets_hash"]
13551362
]["_accessed"]
13561363
is True

‎scripts/populate_tox/releases.jsonl‎

Lines changed: 33 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎scripts/split_tox_gh_actions/split_tox_gh_actions.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
This way each group of frameworks defined in tox.ini will get its own GitHub actions configuration file
55
which allows them to be run in parallel in GitHub actions.
66
7-
This will generate/update several configuration files, that need to be commited to Git afterwards.
7+
This will generate/update several configuration files, that need to be committed to Git afterwards.
88
Whenever tox.ini is changed, this script needs to be run.
99
1010
Usage:

0 commit comments

Comments
 (0)