Generated files must be present before invocation to be included in package_data
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
I've created the following repository to demonstrate the problem:
https://github.com/JonathonReinhart/setuptools-package_data-issue
Copying what I've shown there:
This repository is an MCVE for the following issues:
- https://github.com/JonathonReinhart/scuba/issues/77
- https://github.com/JonathonReinhart/staticx/issues/22
Problem statement
When python setup.py sdist bdist_wheel is invoked from a clean starting point, data files (identified in package_data), which are generated during setup.py hooks, will not be included in the wheel.
- From a clean starting point (
git clean -fdx) (primarily removesmkpkg/generated_data):python setup.py bdist_wheel- OKpython setup.py sdistthenpython setup.py bdist_wheel- OKpython setup.py sdist bdist_wheel- BROKEN
Steps to reproduce
First:
- Run
git clean -fdx-- remove any generated files - Run
python setup.py sdist bdist_wheel - Observe only the following line in the output:
copying build/lib/mypkg/__init__.py -> build/bdist.linux-x86_64/wheel/mypkg
- Run
unzip -l dist/mypkg-1.2.3-py2-none-any.whl- Observe that
mypkg/generated_datais missing from the wheel
- Observe that
Now that mypkg/generated_data is present:
- Run
python setup.py sdist bdist_wheelagain - Observe the following lines in the output:
copying build/lib/mypkg/generated_data -> build/bdist.linux-x86_64/wheel/mypkgcopying build/lib/mypkg/__init__.py -> build/bdist.linux-x86_64/wheel/mypkg
- Run
unzip -l dist/mypkg-1.2.3-py2-none-any.whl- Observe that
mypkg/generated_datais now present in the wheel
- Observe that
Clean the directory, and run other variations of sdist and bdist_wheel (as mentioned above) and observe that the problem does not manifest.
Workarounds that do not work
- Hooking
build_pyinstead ofbuild
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with git clean -fdx and python setup.py sdist bdist_wheel, then inspect setup.py, its generation hooks, package_data, sdist, and bdist_wheel behavior. Compare the combined command with the separate sdist and bdist_wheel runs. Done means generated_data is included in the wheel from a clean starting point.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100