So, I have this little pyproject.toml-based project (named RecordEcos
) to do multi-camera recording with a minimalist interface (using PySimpleGUI). The interface make use of a placeholder image when the camera are not connected.
I've added the following section to my pyproject.toml to ensure the image is well embedded into the wheel.
[tool.setuptools.package-data]
RecordEcos = ["*.png"]
And indeed, everything works perfectly on my laptop:
$ python -m build | grep Placeholder
copying RecordEcos/gui/img/Placeholder.png -> RecordEcos-0.4.5/RecordEcos/gui/img
copying RecordEcos/gui/img/Placeholder.png -> build/lib/RecordEcos/gui/img
copying build/lib/RecordEcos/gui/img/Placeholder.png -> build/bdist.linux-x86_64/wheel/RecordEcos/gui/img
adding 'RecordEcos/gui/img/Placeholder.png'
Actually, it's working on my laptop even if I don't add the setuptools package-data
option. Which seems to be quite consonant with setuptools documentation.
So I've pushed it to gitlab, the CI has been triggered... And the resulting wheel does not contains the image.
So to be sure, I've try it within a docker image:
laptop $ docker run -it python:3.11 /bin/bash
python-container $ pip install build
python-container $ git clone <repository>
python-container $ cd <repository>
python-container & python -m build | grep Placeholder
The image is not copied !
Does someone have any clue what's happening there ?
I've tried it with the alpine, slim and bookworm variants of python:3.11
laptop under ArchLinux
Python & packages
Python: 3.11.8
build: 1.1.1
setuptools: 65.6.0
gitlab-ci.yml
build:
stage: build
image: python:3.11-alpine
script:
- pip install build
- python -m build
artifacts:
untracked: false
when: on_success
expire_in: "30 days"
paths:
- dist/
I don't know this for a fact, but I believe you either need to explicitly call out the package_data argument, or you need to setup a Manifest file.
https://setuptools.pypa.io/en/latest/userguide/miscellaneous.html#using-manifest-in