Skip to content

Commit 8cfa94f

Browse files
Revert pyproject.toml changes, refactor sed command (#720)
* Revert pyproject.toml changes and add environment variable for ddtrace wheel sed command * version typo * add commit branch variable * prints * fix environment variable checks * Remove debug prints * eof newline
1 parent 88bf2f2 commit 8cfa94f

File tree

3 files changed

+13
-30
lines changed

3 files changed

+13
-30
lines changed

.github/workflows/build_layer.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,10 @@ jobs:
3434
pip download --no-index --no-deps --find-links https://dd-trace-py-builds.s3.amazonaws.com/main/index.html --pre --python-version "${{ matrix.python_version}}" --platform "${PLATFORM_TAG}" ddtrace
3535
echo "wheel_path=$(find . -name "*.whl" | head -n 1)" >> $GITHUB_OUTPUT
3636
37-
- name: Patch pyproject.toml
38-
run: |
39-
echo "Patching pyproject.toml to use latest build of dd-trace-py"
40-
sed -i 's|^ddtrace =.*$|ddtrace = { file = "${{ steps.find-ddtrace-wheel.outputs.wheel_path }}" }|' pyproject.toml
41-
4237
- name: Build layer for Python ${{ matrix.python_version }} on ${{ matrix.arch }}
4338
run: |
4439
echo "Building layer for Python ${{ matrix.python_version }} on ${{ matrix.arch }}"
45-
ARCH=${{ matrix.arch }} PYTHON_VERSION=${{ matrix.python_version }} ./scripts/build_layers.sh
40+
ARCH=${{ matrix.arch }} PYTHON_VERSION=${{ matrix.python_version }} DD_TRACE_WHEEL="${{ steps.find-ddtrace-wheel.outputs.wheel_path }}" ./scripts/build_layers.sh
4641
4742
- name: Upload layer artifact
4843
uses: actions/upload-artifact@v4

pyproject.toml

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,19 @@ name = "datadog_lambda"
33
version = "8.123.0.dev0"
44
description = "The Datadog AWS Lambda Library"
55
authors = ["Datadog, Inc. <dev@datadoghq.com>"]
6-
7-
[project]
8-
name = "datadog_lambda"
96
license = "Apache-2.0"
107
readme = "README.md"
11-
requires-python = ">=3.8.0,<4"
128
repository = "https://github.com/DataDog/datadog-lambda-python"
139
keywords = [
1410
"datadog",
1511
"aws",
1612
"lambda",
1713
"layer",
1814
]
19-
dependencies = [
20-
"datadog>=0.51.0,<1.0.0",
21-
"wrapt>=1.11.2,<2",
22-
"ddtrace>=3.19.1,<4; python_version>='3.9.0' and python_version < '3.10'",
23-
"ddtrace>=4.1.1,<5; python_version>='3.10.0'",
24-
"ujson>=5.9.0",
25-
]
2615
packages = [
2716
{ include = "datadog_lambda" }
2817
]
2918
classifiers = [
30-
"Programming Language :: Python :: 3 :: Only",
3119
"Programming Language :: Python :: 3.8",
3220
"Programming Language :: Python :: 3.9",
3321
"Programming Language :: Python :: 3.10",
@@ -37,13 +25,14 @@ classifiers = [
3725
"Programming Language :: Python :: 3.14",
3826
]
3927

40-
# can remove tool.poetry.depencies and tool.poetry.extras
41-
# after deprecation of Python 3.8
4228
[tool.poetry.dependencies]
4329
python = ">=3.8.0,<4"
4430
datadog = ">=0.51.0,<1.0.0"
4531
wrapt = "^1.11.2"
46-
ddtrace = ">=3.19.1,<4"
32+
ddtrace = [
33+
{version = ">=3.19.1,<4", python = ">=3.8,<3.10"},
34+
{version = ">=4.1.1,<5", python = ">=3.10"}
35+
]
4736
ujson = ">=5.9.0"
4837
botocore = { version = "^1.34.0", optional = true }
4938
requests = { version ="^2.22.0", optional = true }
@@ -60,15 +49,6 @@ dev = [
6049
"requests",
6150
]
6251

63-
[project.optional-dependencies]
64-
dev = [
65-
"botocore>=1.34.0,<2",
66-
"requests>=2.22.0,<3",
67-
"pytest>=8.0.0,<9",
68-
"pytest-benchmark>=4.0,<5",
69-
"flake8>=5.0.4,<6",
70-
]
71-
7252
[build-system]
7353
requires = ["poetry-core>=1.0.0"]
7454
build-backend = "poetry.core.masonry.api"

scripts/build_layers.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ else
4646
PYTHON_VERSIONS=$PYTHON_VERSION
4747
fi
4848

49+
# Replace ddtrace wheel used if necessary
50+
if [ -n "$DD_TRACE_COMMIT_BRANCH" ]; then
51+
sed -z -E -i 's|(ddtrace = )\[[^]]*]|\1{ git = "https://github.com/DataDog/dd-trace-py.git", branch = \"'"$DD_TRACE_COMMIT_BRANCH"'\" }|g' pyproject.toml
52+
else
53+
if [ -n "$DD_TRACE_WHEEL" ]; then
54+
sed -z -E -i 's|(ddtrace = )\[[^]]*]|\1{ file = "'"$DD_TRACE_WHEEL"'" }|g' pyproject.toml
55+
fi
56+
fi
4957

5058
function make_path_absolute {
5159
echo "$(cd "$(dirname "$1")"; pwd)/$(basename "$1")"

0 commit comments

Comments
 (0)