Skip to content

Conversation

@Leon-hk
Copy link
Contributor

@Leon-hk Leon-hk commented Nov 20, 2025

This is a follow up of #3695
Depends on merge of python-gardenlinux-lib #253

What this PR does / why we need it:

  • Removes exportLibs.py script from pythonDev feature
  • Installs python-gardenlinux-lib on pythonDev feature
  • Adds feature tests to check if exporting the shared libraries for the requests package works as expected

Which issue(s) this PR fixes:
Fixes #3889

- **Multi-stage Dockerfile**:
```Dockerfile
FROM ghcr.io/gardenlinux/gardenlinux/container-python-dev:1877.5 as packages
FROM ghcr.io/gardenlinux/gardenlinux/container-python-dev:1877.8 as packages
Copy link
Member

Choose a reason for hiding this comment

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

this image is not published yet?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the first PR was merged after the release of 1877.7. And as this draft would also change the interface from RUN exportLibs.py to RUN gl-build export-python-libs, I've changed the version to a release which would probably contain the updated version, to have a working example

COPY requirements.txt /
RUN pip3 install -r requirements.txt --break-system-packages --no-cache-dir
RUN exportLibs.py
RUN gl-build export-python-libs
Copy link
Member

Choose a reason for hiding this comment

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

how does gl-build end up in that image? this is a script from the gl-python-lib, but in the pythonDev feature this library is not installed (not suggesting it should), but then an extra step would be required in this dockerfile, right?

Copy link
Member

Choose a reason for hiding this comment

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

nevermind, just noticed it is part of this pr

@Leon-hk
Copy link
Contributor Author

Leon-hk commented Dec 1, 2025

I've restored an updated version of the exportLibs.py script, if we decide to use the python-gardenlinux-lib we can rollback

@Leon-hk
Copy link
Contributor Author

Leon-hk commented Dec 18, 2025

End of the year state of this PR: Depends on the decision of #3952

@Leon-hk
Copy link
Contributor Author

Leon-hk commented Jan 26, 2026

I've restored an updated version of the exportLibs.py script, if we decide to use the python-gardenlinux-lib we can rollback

Due to ADR 30, the current version of the PR, not using python-gardenlinux-lib, is the preferred version. Therefore it is ready for review.

@Leon-hk Leon-hk marked this pull request as ready for review January 26, 2026 15:15
@Leon-hk Leon-hk changed the title Replace exportLibs.py by installation of python-gardenlinux-lib Enhance and test exportLibs.py Jan 27, 2026

# shellcheck source=/dev/null
source venv/bin/activate
pip install pyelftools
Copy link
Member

Choose a reason for hiding this comment

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

what's the rationale for this installation method? did you evaluate packaging this as a debian package? not sure if this is what we want, please get feedback from @nkraetzschmar

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The exportLibs.py script runs in a virtual environment, as it requires pyelftools. This is necessary to have a completely fresh python environment of the system, as the dist-packages are later copied to the bare-python image. If we would install pyelftools system wide, it would be always contained in the bare-python image, even if it is not used.

Copy link
Member

Choose a reason for hiding this comment

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

that seems reasonable, thanks for explaining, but I think this is obscure enough that it should be documented (a comment in the script is fine imo)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, makes sense 👍 I've added a comment.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: use python-gardenlinux-lib for exporting shared libraries from container-python-dev

3 participants