pip 21.3+ in-tree builds with setuptools, do not clean local build directories
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
Description
Given a requirements.txt including a local package path, installing them will litter the local path with in-tree build folders.
This is slightly bloating docker builds and causing some issues due to build artifacts permissions that force us to clean every local build folder with
WORKDIR /path/to/package-1
RUN python setup.py clean --all
WORKDIR /path/to/package-2
RUN python setup.py clean --all
# etc
but note this won't slim image sizes either.
Expected behavior
Previous pip versions built local packages in folders like /tmp/pip-req-build-XXXXXXX/ . Regardless of being in-tree or out-of-tree, the point is those folders vanished at the end of a pip install instruction unless the --no-clean flag was used.
pip version
21.3
Python version
3.9.7
OS
GNU/Linux + Docker 20.10.8
How to Reproduce
git clone https://github.com/pypa/sampleproject.git /tmp/sampleprojectpip install --use-feature=in-tree-build /tmp/sampleprojectfind /tmp/sampleproject/build
Output
/tmp/sampleproject/build
/tmp/sampleproject/build/bdist.linux-x86_64
/tmp/sampleproject/build/lib
/tmp/sampleproject/build/lib/sample
/tmp/sampleproject/build/lib/sample/__init__.py
/tmp/sampleproject/build/lib/sample/simple.py
/tmp/sampleproject/build/lib/sample/package_data.dat
Code of Conduct
- I agree to follow the PSF Code of Conduct.
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
Reproduce the behavior with sampleproject using pip install --use-feature=in-tree-build /tmp/sampleproject, then inspect the build cleanup path involved in the setuptools invocation. Compare the generated build directory with the expected temporary-build behavior and verify that a completed install does not leave local build artifacts behind.
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
- Mostly clear
- Newbie friendliness
- 35/100