Skip to content

Commit 980d1e3

Browse files
authored
fix: download wheels targeting Python 3.13 with pinned requirements (#564)
- Use --python-version 313 --platform any --implementation py --abi none to ensure legacy build containers (Python 3.7) download correct wheels - Add requirements-pyodide.txt lock file for reproducible builds - Restore maintenance workflow to keep requirements up to date weekly
1 parent b7d9173 commit 980d1e3

3 files changed

Lines changed: 111 additions & 4 deletions

File tree

.github/workflows/maintenance.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Automated Maintenance
2+
3+
on:
4+
schedule:
5+
- cron: '0 10 * * 1'
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
get-configs:
14+
uses: ./.github/workflows/configs.yml
15+
16+
maintenance:
17+
needs: [get-configs]
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v5
21+
22+
- name: Setup Node.js ${{ needs.get-configs.outputs.node-version }}
23+
uses: actions/setup-node@v6
24+
with:
25+
node-version: ${{ needs.get-configs.outputs.node-version }}
26+
cache: 'npm'
27+
28+
- name: Install Dependencies
29+
run: npm ci
30+
31+
- name: Install git-secrets
32+
run: |
33+
git clone https://github.com/awslabs/git-secrets.git /tmp/git-secrets
34+
cd /tmp/git-secrets
35+
sudo make install
36+
37+
- name: Update requirements-pyodide.txt
38+
run: |
39+
PACKAGES=$(grep -v '^#' requirements-pyodide.txt | grep -v '^$' | sed 's/==.*//' | tr '\n' ' ')
40+
41+
rm -rf /tmp/wheels-update && mkdir /tmp/wheels-update
42+
python3 -m pip download --dest /tmp/wheels-update \
43+
--only-binary=:all: --python-version 313 --platform any \
44+
--implementation py --abi none --no-deps $PACKAGES
45+
46+
# Regenerate lock file from downloaded wheel filenames
47+
head -8 requirements-pyodide.txt > /tmp/requirements-header.txt
48+
ls /tmp/wheels-update/*.whl | xargs -I{} basename {} | sort | \
49+
sed 's/^\(.*\)-\(.*\)-py[23].*/\1==\2/' | sed 's/_/-/g' \
50+
> /tmp/requirements-pins.txt
51+
cat /tmp/requirements-header.txt /tmp/requirements-pins.txt > requirements-pyodide.txt
52+
53+
- name: Verify wheels download
54+
run: npm run download-wheels
55+
56+
- name: Create Pull Request
57+
uses: peter-evans/create-pull-request@v7
58+
with:
59+
commit-message: 'chore: Maintenance update'
60+
branch: maintenance/update
61+
delete-branch: true
62+
title: 'chore: Maintenance Update'
63+
body: |
64+
Automated maintenance update.
65+
66+
- Updated wheels via download-wheels
67+
68+
This PR was created by the `maintenance` workflow.
69+
70+
> To trigger validation, close and reopen this PR.
71+
labels: maintenance, automated

requirements-pyodide.txt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Pure-Python wheels for cfn-lint in Pyodide (Python 3.13)
2+
# These are downloaded at build time and bundled as offline fallback.
3+
# Compiled packages (pyyaml, regex, rpds-py, pydantic-core) are fetched
4+
# separately from the Pyodide CDN as wasm32 wheels.
5+
#
6+
# To update: run `python3 -m pip download --only-binary=:all: --python-version 313
7+
# --platform any --implementation py --abi none --no-deps <packages>`
8+
# and update the pinned versions below.
9+
cfn-lint==1.50.1
10+
aws-sam-translator==1.109.0
11+
jsonpatch==1.33
12+
jsonpointer==3.1.1
13+
networkx==3.6.1
14+
sympy==1.14.0
15+
mpmath==1.4.1
16+
typing_extensions==4.15.0
17+
boto3==1.43.4
18+
botocore==1.43.4
19+
jmespath==1.1.0
20+
s3transfer==0.17.0
21+
python-dateutil==2.9.0.post0
22+
six==1.17.0
23+
urllib3==2.6.3
24+
jsonschema==4.26.0
25+
jsonschema-specifications==2025.9.1
26+
referencing==0.37.0
27+
attrs==26.1.0
28+
annotated-types==0.7.0

tools/download-wheels.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,18 @@ function downloadWheels(): void {
3030

3131
try {
3232
// 1. Download cfn-lint and pure Python dependencies via pip
33-
execSync('python3 -m pip download --dest ' + wheelsDir + ' --only-binary=:all: cfn-lint', {
34-
stdio: 'inherit',
35-
cwd: projectRoot,
36-
});
33+
// Use --python-version 313 to ensure we get wheels compatible with Pyodide's Python 3.13,
34+
// regardless of the host Python version (e.g. Python 3.7 on legacy build containers).
35+
const requirementsFile = join(projectRoot, 'requirements-pyodide.txt');
36+
execSync(
37+
`python3 -m pip download --dest ${wheelsDir}` +
38+
` --only-binary=:all: --python-version 313 --platform any --implementation py --abi none` +
39+
` --no-deps -r ${requirementsFile}`,
40+
{
41+
stdio: 'inherit',
42+
cwd: projectRoot,
43+
},
44+
);
3745

3846
// 2. Remove host-platform wheels for Pyodide-managed packages (pip gets the wrong arch)
3947
const wheels = readdirSync(wheelsDir).filter((file) => file.endsWith('.whl'));

0 commit comments

Comments
 (0)