Skip to content

Commit ea11be2

Browse files
ci: replace poetry with uv (#7910)
1 parent ed6535d commit ea11be2

25 files changed

Lines changed: 5070 additions & 6145 deletions

‎.github/boring-cyborg.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ labelPRBasedOnFilePath:
8585

8686
dependencies:
8787
- pyproject.toml
88-
- poetry.lock
88+
- uv.lock
8989

9090
tests:
9191
- tests/*

‎.github/dependabot.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ updates:
1313
patterns:
1414
- "*"
1515

16-
- package-ecosystem: "pip"
16+
- package-ecosystem: "uv"
1717
directory: "/"
1818
schedule:
1919
interval: "weekly"

‎.github/workflows/pre-release.yml‎

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,22 @@ jobs:
6565

6666
- name: Set release version
6767
id: release_version
68-
run: echo "RELEASE_VERSION=${{ inputs.version }}" >> "$GITHUB_OUTPUT"
69-
70-
- name: Verify pre-release version semantics
7168
run: |
72-
if [[ ! "${{ inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+[a-b][0-9]+$ ]]; then
73-
echo "Version ${{ inputs.version }} doesn't look like a pre-release version (e.g., 3.24.0a0); aborting"
69+
VERSION_PART='(0|[1-9][0-9]*)'
70+
if [[ ! "$RELEASE_VERSION" =~ ^${VERSION_PART}\.${VERSION_PART}\.${VERSION_PART}(a|b|rc)${VERSION_PART}$ ]]; then
71+
echo "Invalid pre-release version: $RELEASE_VERSION"
7472
exit 1
7573
fi
76-
77-
- name: Update version in pyproject.toml
78-
run: sed -i 's/^version = ".*"/version = "${{ inputs.version }}"/' pyproject.toml
79-
80-
- name: Update version in version.py
81-
run: sed -i 's/^VERSION = ".*"/VERSION = "${{ inputs.version }}"/' aws_lambda_powertools/shared/version.py
74+
sed -i "/^\[project\]$/,/^\[/s/^version = \".*\"/version = \"${RELEASE_VERSION}\"/" pyproject.toml
75+
sed -i "s/^VERSION = \".*\"/VERSION = \"${RELEASE_VERSION}\"/" aws_lambda_powertools/shared/version.py
76+
sed -i "/^name = \"aws-lambda-powertools\"$/{n;s/^version = \".*\"/version = \"${RELEASE_VERSION}\"/;}" uv.lock
77+
# Stop before sealing if a field was missing or its format changed.
78+
test "$(sed -n '/^\[project\]$/,/^\[/p' pyproject.toml | grep '^version = ')" = "version = \"${RELEASE_VERSION}\""
79+
test "$(grep '^VERSION = ' aws_lambda_powertools/shared/version.py)" = "VERSION = \"${RELEASE_VERSION}\""
80+
test "$(sed -n '/^name = "aws-lambda-powertools"$/{n;p;}' uv.lock)" = "version = \"${RELEASE_VERSION}\""
81+
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> "$GITHUB_OUTPUT"
82+
env:
83+
RELEASE_VERSION: ${{ inputs.version }}
8284

8385
- name: Seal and upload
8486
id: seal_source_code
@@ -112,13 +114,15 @@ jobs:
112114
- name: Debug cache restore
113115
run: cat pyproject.toml
114116

115-
- name: Install poetry
116-
run: pipx install git+https://github.com/python-poetry/poetry@bd500dd3bdfaec3de6894144c9cedb3a9358be84 # v2.0.1
117+
- name: Set up uv
118+
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
119+
with:
120+
version: "0.12.19"
121+
enable-cache: true
117122
- name: Set up Python
118123
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
119124
with:
120125
python-version: "3.14"
121-
cache: "poetry"
122126
- name: Install dependencies
123127
run: make dev
124128
- name: Run all tests, linting and baselines
@@ -150,16 +154,18 @@ jobs:
150154
integrity_hash: ${{ needs.seal.outputs.integrity_hash }}
151155
artifact_name: ${{ needs.seal.outputs.artifact_name }}
152156

153-
- name: Install poetry
154-
run: pipx install git+https://github.com/python-poetry/poetry@bd500dd3bdfaec3de6894144c9cedb3a9358be84 # v2.0.1
157+
- name: Set up uv
158+
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
159+
with:
160+
version: "0.12.19"
161+
enable-cache: true
155162
- name: Set up Python
156163
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
157164
with:
158165
python-version: "3.14"
159-
cache: "poetry"
160166

161167
- name: Build python package and wheel
162-
run: poetry build
168+
run: uv build --no-sources
163169

164170
- name: Seal and upload
165171
id: seal_build
@@ -258,7 +264,7 @@ jobs:
258264
id: create-pr
259265
uses: ./.github/actions/create-pr
260266
with:
261-
files: "pyproject.toml aws_lambda_powertools/shared/version.py provenance/"
267+
files: "pyproject.toml uv.lock aws_lambda_powertools/shared/version.py provenance/"
262268
temp_branch_prefix: "ci-bump"
263269
pull_request_title: "chore(ci): new pre-release ${{ needs.seal.outputs.RELEASE_VERSION }}"
264270
github_token: ${{ secrets.GITHUB_TOKEN }}

‎.github/workflows/publish_v3_layer.yml‎

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,11 @@ jobs:
118118
integrity_hash: ${{ inputs.source_code_integrity_hash }}
119119
artifact_name: ${{ inputs.source_code_artifact_name }}
120120

121-
- name: Install poetry
122-
run: |
123-
pipx install git+https://github.com/python-poetry/poetry@bd500dd3bdfaec3de6894144c9cedb3a9358be84 # v2.0.1
124-
pipx inject poetry git+https://github.com/python-poetry/poetry-plugin-export@8c83d26603ca94f2e203bfded7b6d7f530960e06 # v1.8.0
121+
- name: Set up uv
122+
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
123+
with:
124+
version: "0.12.19"
125+
enable-cache: true
125126
- name: Setup Node.js
126127
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
127128
with:
@@ -130,13 +131,8 @@ jobs:
130131
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
131132
with:
132133
python-version: ${{ matrix.python-version }}
133-
cache: "pip"
134-
- name: Resolve and install project dependencies
135-
# CDK spawns system python when compiling stack
136-
# therefore it ignores both activated virtual env and cached interpreter by GH
137-
run: |
138-
poetry export --format requirements.txt --output requirements.txt
139-
pip install --require-hashes -r requirements.txt
134+
- name: Install dependencies
135+
run: uv sync --locked --no-build
140136

141137
- name: Set up QEMU
142138
uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0
@@ -163,9 +159,14 @@ jobs:
163159
run: sleep 60
164160

165161
- name: CDK build
166-
run: npx cdk synth --verbose --context version="${{ inputs.latest_published_version }}" --context pythonVersion="python${{ matrix.python-version }}" -o cdk.out
162+
run: >-
163+
uv run --locked --no-build npx cdk synth --verbose
164+
--context "version=${LAYER_PACKAGE_VERSION}"
165+
--context "pythonVersion=python${PYTHON_RUNTIME}" -o cdk.out
167166
env:
168167
BUILDX_BUILDER: ${{ steps.builder.outputs.name }}
168+
LAYER_PACKAGE_VERSION: ${{ inputs.latest_published_version }}
169+
PYTHON_RUNTIME: ${{ matrix.python-version }}
169170
- name: zip output
170171
run: zip -r cdk.py${{ matrix.python-version }}.out.zip cdk.out
171172
- name: Archive CDK artifacts

‎.github/workflows/quality_check.yml‎

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,16 @@ on:
2121
- "tests/**"
2222
- "examples/**"
2323
- "pyproject.toml"
24-
- "poetry.lock"
24+
- "uv.lock"
2525
- "mypy.ini"
26+
- "Makefile"
27+
- "noxfile.py"
28+
- ".pre-commit-config.yaml"
29+
- ".github/workflows/quality_check.yml"
30+
- ".github/workflows/release-v3.yml"
31+
- ".github/workflows/pre-release.yml"
32+
- ".github/actions/seal/**"
33+
- ".github/actions/seal-restore/**"
2634
branches:
2735
- develop
2836
push:
@@ -31,8 +39,16 @@ on:
3139
- "tests/**"
3240
- "examples/**"
3341
- "pyproject.toml"
34-
- "poetry.lock"
42+
- "uv.lock"
3543
- "mypy.ini"
44+
- "Makefile"
45+
- "noxfile.py"
46+
- ".pre-commit-config.yaml"
47+
- ".github/workflows/quality_check.yml"
48+
- ".github/workflows/release-v3.yml"
49+
- ".github/workflows/pre-release.yml"
50+
- ".github/actions/seal/**"
51+
- ".github/actions/seal-restore/**"
3652
branches:
3753
- develop
3854

@@ -53,8 +69,11 @@ jobs:
5369
contents: read # checkout code only
5470
steps:
5571
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
56-
- name: Install poetry
57-
run: pipx install poetry
72+
- name: Set up uv
73+
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
74+
with:
75+
version: "0.12.19"
76+
enable-cache: true
5877
- name: Set up Python ${{ matrix.python-version }}
5978
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
6079
with:

‎.github/workflows/quality_code_cdk_constructor.yml‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,17 @@ on:
1616
pull_request:
1717
paths:
1818
- "layer_v3/layer_constructors/**"
19+
- "layer_v3/pyproject.toml"
20+
- "layer_v3/uv.lock"
21+
- ".github/workflows/quality_code_cdk_constructor.yml"
1922
branches:
2023
- develop
2124
push:
2225
paths:
2326
- "layer_v3/layer_constructors/**"
27+
- "layer_v3/pyproject.toml"
28+
- "layer_v3/uv.lock"
29+
- ".github/workflows/quality_code_cdk_constructor.yml"
2430
branches:
2531
- develop
2632

@@ -43,13 +49,15 @@ jobs:
4349
working-directory: ./layer_v3/layer_constructors
4450
steps:
4551
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
46-
- name: Install poetry
47-
run: pipx install poetry
52+
- name: Set up uv
53+
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
54+
with:
55+
version: "0.12.19"
56+
enable-cache: true
4857
- name: Set up Python ${{ matrix.python-version }}
4958
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
5059
with:
5160
python-version: ${{ matrix.python-version }}
52-
cache: "poetry"
5361
- name: Set up QEMU
5462
uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0
5563
with:
@@ -62,10 +70,8 @@ jobs:
6270
driver: docker
6371
platforms: linux/amd64,linux/arm64
6472
- name: Install dependencies
65-
run: |
66-
pip install --upgrade pip pre-commit poetry
67-
poetry install
73+
run: uv sync --locked --no-build
6874
- name: Test with pytest
69-
run: poetry run pytest tests
75+
run: uv run --locked --no-build pytest tests
7076
env:
7177
BUILDX_BUILDER: ${{ steps.builder.outputs.name }}

‎.github/workflows/release-v3.yml‎

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -86,22 +86,28 @@ jobs:
8686
id: release_version
8787
# transform tag format `v<version` to `<version>`
8888
run: |
89-
RELEASE_VERSION="${RELEASE_TAG_VERSION:1}"
89+
RELEASE_VERSION="${RELEASE_TAG_VERSION#v}"
90+
VERSION_PART='(0|[1-9][0-9]*)'
91+
if [[ ! "$RELEASE_VERSION" =~ ^${VERSION_PART}\.${VERSION_PART}\.${VERSION_PART}((a|b|rc)${VERSION_PART})?$ ]]; then
92+
echo "Invalid release version: $RELEASE_VERSION"
93+
exit 1
94+
fi
9095
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> "$GITHUB_OUTPUT"
9196
9297
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
9398
with:
9499
ref: ${{ env.RELEASE_COMMIT }}
95100

96-
# We use a pinned version of Poetry to be certain it won't modify source code before we create a hash
97-
- name: Install poetry
98-
run: |
99-
pipx install git+https://github.com/python-poetry/poetry@bd500dd3bdfaec3de6894144c9cedb3a9358be84 # v2.0.1
100-
pipx inject poetry git+https://github.com/monim67/poetry-bumpversion@348de6f247222e2953d649932426e63492e0a6bf # v0.3.3
101-
102101
- name: Bump package version
103102
id: versioning
104-
run: poetry version "${RELEASE_VERSION}"
103+
run: |
104+
sed -i "/^\[project\]$/,/^\[/s/^version = \".*\"/version = \"${RELEASE_VERSION}\"/" pyproject.toml
105+
sed -i "s/^VERSION = \".*\"/VERSION = \"${RELEASE_VERSION}\"/" aws_lambda_powertools/shared/version.py
106+
sed -i "/^name = \"aws-lambda-powertools\"$/{n;s/^version = \".*\"/version = \"${RELEASE_VERSION}\"/;}" uv.lock
107+
# Stop before sealing if a field was missing or its format changed.
108+
test "$(sed -n '/^\[project\]$/,/^\[/p' pyproject.toml | grep '^version = ')" = "version = \"${RELEASE_VERSION}\""
109+
test "$(grep '^VERSION = ' aws_lambda_powertools/shared/version.py)" = "VERSION = \"${RELEASE_VERSION}\""
110+
test "$(sed -n '/^name = "aws-lambda-powertools"$/{n;p;}' uv.lock)" = "version = \"${RELEASE_VERSION}\""
105111
env:
106112
RELEASE_VERSION: ${{ steps.release_version.outputs.RELEASE_VERSION}}
107113

@@ -137,13 +143,15 @@ jobs:
137143
- name: Debug cache restore
138144
run: cat pyproject.toml
139145

140-
- name: Install poetry
141-
run: pipx install git+https://github.com/python-poetry/poetry@bd500dd3bdfaec3de6894144c9cedb3a9358be84 # v2.0.1
146+
- name: Set up uv
147+
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
148+
with:
149+
version: "0.12.19"
150+
enable-cache: true
142151
- name: Set up Python
143152
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
144153
with:
145154
python-version: "3.14"
146-
cache: "poetry"
147155
- name: Install dependencies
148156
run: make dev
149157
- name: Run all tests, linting and baselines
@@ -175,16 +183,18 @@ jobs:
175183
integrity_hash: ${{ needs.seal.outputs.integrity_hash }}
176184
artifact_name: ${{ needs.seal.outputs.artifact_name }}
177185

178-
- name: Install poetry
179-
run: pipx install git+https://github.com/python-poetry/poetry@bd500dd3bdfaec3de6894144c9cedb3a9358be84 # v2.0.1
186+
- name: Set up uv
187+
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
188+
with:
189+
version: "0.12.19"
190+
enable-cache: true
180191
- name: Set up Python
181192
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
182193
with:
183194
python-version: "3.14"
184-
cache: "poetry"
185195

186196
- name: Build python package and wheel
187-
run: poetry build
197+
run: uv build --no-sources
188198

189199
- name: Seal and upload
190200
id: seal_build
@@ -287,7 +297,7 @@ jobs:
287297
288298
- name: Create Git Tag
289299
run: |
290-
git add pyproject.toml aws_lambda_powertools/shared/version.py
300+
git add pyproject.toml uv.lock aws_lambda_powertools/shared/version.py
291301
git commit -m "chore: version bump"
292302
git tag -a v"${RELEASE_VERSION}" -m "release_version: v${RELEASE_VERSION}"
293303
git push origin v"${RELEASE_VERSION}"
@@ -326,7 +336,7 @@ jobs:
326336
id: create-pr
327337
uses: ./.github/actions/create-pr
328338
with:
329-
files: "pyproject.toml aws_lambda_powertools/shared/version.py"
339+
files: "pyproject.toml uv.lock aws_lambda_powertools/shared/version.py"
330340
temp_branch_prefix: "ci-bump"
331341
pull_request_title: "chore(ci): bump version to ${{ needs.seal.outputs.RELEASE_VERSION }}"
332342
github_token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)