Handle setuptools
leftover build artifacts
#127
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue:
Setuptools leaves behind build artifacts instead of cleaning them up. This can cause unexpected errors due to old build artifacts being re-used.
Ref: pypa/setuptools#1347
Solution:
Use a context manager to setup a directory with all the source code and set the
setup()
context. The context manager handles removal of the directory when the process finishes.This might need to be updated if we move to different types of releases, such as pipy, but at the moment we use pip install from the source directory or directly from github with git or zip.
cmdclass
to override some of the behavior ofsetuptools
, it requires class overrides andsetuptools
handles the execution order.atexit
can be used to setup a function to cleanup directories but it is a blind removal based on directory name and still requires removal of pre-existing build artifacts. There is supposed to be a pip marker file in the directory, but it is missing.Original: #124
Revert: #125