Skip to content

Conversation

@Fares-Abubaker
Copy link

@Fares-Abubaker Fares-Abubaker commented Sep 14, 2025

Issue #, if available:

Description of changes:

🔄 What Changed

  • Updated all Python build images:

    • Replaced

      pip3 install wheel setuptools

      with

      pip3 install setuptools

📝 Why

References:


✅ Verification

  • Built images:

    • amazon/aws-sam-cli-build-image-python3.12:x86_64 (SAM CLI 1.144.0)
    • amazon/aws-sam-cli-build-image-python3.13:x86_64 (SAM CLI 1.144.0)
  • Tests:

    • pytest runtime tests (3.12) → Passed.

    • Manual builds inside both images:

      • aiohttp@v3.11.11 via requirements.txt → ✅ succeeded.
      • cryptography==43.0.1 → ✅ succeeded.
  • Outcome: Removing wheel and ensuring setuptools resolves the failure and supports packages requiring wheel builds and VCS installs.


📊 Impact

  • Removes unnecessary system package (wheel).
  • Keeps images aligned with modern Python packaging practices.
  • No regressions observed in functional and package build tests.

🚀 How to Reproduce

  1. Build images:

    SAM_CLI_VERSION=1.144.0 RUNTIME=python312 make build-x86_64-arch
    SAM_CLI_VERSION=1.144.0 RUNTIME=python313 make build-x86_64-arch
  2. Inside container, run sam build with a temp app requiring:

    • cryptography==43.0.1
    • git+https://github.com/aio-libs/aiohttp.git@v3.11.11
  3. Both builds should succeed without installing wheel system-wide.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@Fares-Abubaker Fares-Abubaker requested a review from a team as a code owner September 14, 2025 00:04
@github-actions github-actions bot added pr/external stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Sep 14, 2025
@Fares-Abubaker
Copy link
Author

@roger-zhangg Can you check please

@Fares-Abubaker
Copy link
Author

I added a new commit to do it for all Python versions

@Fares-Abubaker Fares-Abubaker changed the title Python 3.12/3.13 build images: install setuptools only; remove wheel Python build images: install setuptools only; remove wheel Sep 14, 2025
@vicheey
Copy link
Contributor

vicheey commented Sep 15, 2025

Running workflow now.

@Fares-Abubaker
Copy link
Author

@vicheey issue in build dotnet7 should not be related to this PR, isn't it?

Copy link
Contributor

@seshubaws seshubaws left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Fares-Abubaker, thank you for raising this PR! Let's keep wheel alongside setuptools for now, since even though tested this new build, it could be the case that cryptography or another library that needs wheel had prebuilt wheels available, and so did not require wheel. However, this could fail if there are no prebuilt wheels for a dependency, or if an env forces source builds which makes wheel mandatory. Just to be on the safe side, let's keep wheel in the requirements.

@Fares-Abubaker
Copy link
Author

Fares-Abubaker commented Sep 17, 2025

@seshubaws Thanks for the review! I specifically tested a case with no prebuilt wheels:

pip3 install git+ssh://git@github.com/aio-libs/aiohttp.git@v3.11.11

This forces a source build from VCS. It succeeded with only setuptools present (no system-wide wheel). So a separate wheel package in the base image isn’t required as I see.

Also, note that modern setuptools (≥ 70.1) already includes the bdist_wheel functionality and even vendors the wheel package internally, so the standalone wheel package is no longer needed for builds.

@seshubaws
Copy link
Contributor

seshubaws commented Sep 17, 2025

Hi @Fares-Abubaker, thank you for clarifying!

So it seems setuptools wasn't included for Python 3.12+ (edmorley/get-pip@2f463eb). So in theory for Python 3.11 and lower, we don't need to add setuptools, because it should already be there if we have pip (setuptools used to come with pip until recently).

Could you do a check if python3.11 and below still work without explicitly adding setuptools? In theory we should be able to remove wheel without having to add setuptools in python311 and below.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr/external stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants