Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle setuptools leftover build artifacts #127

Merged
merged 2 commits into from
Feb 17, 2024
Merged

Handle setuptools leftover build artifacts #127

merged 2 commits into from
Feb 17, 2024

Conversation

bryan-bar
Copy link
Collaborator

@bryan-bar bryan-bar commented Feb 17, 2024

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.

  • While we can use cmdclass to override some of the behavior of setuptools, it requires class overrides and setuptools 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

…users can supply them, are commonly created alongside an infrastruture configuration instead of using the default and only useful when working directly with edb-ansible.
…tifacts are cleaned up by default.

Pip installation is not cleaning up leftover 'build/' and 'edb_terraform.egg_info/' directories when installing from a local repo and might cause unexpected errors due to old build files being included in the final build.
When calling 'pip install . -vvv', logs show that it calls 'python setup.py egg_info' followed by 'python setup.py bdist_wheel'.
@bryan-bar bryan-bar requested a review from mw2q February 17, 2024 13:29
@bryan-bar bryan-bar changed the title Setuptools leftover artifacts Clean setuptools build artifacts Feb 17, 2024
@bryan-bar bryan-bar changed the title Clean setuptools build artifacts Handle setuptools leftover build artifacts Feb 17, 2024
@bryan-bar bryan-bar merged commit dd2085c into main Feb 17, 2024
@bryan-bar bryan-bar deleted the more-changes branch February 17, 2024 13:52
@bryan-bar bryan-bar added the bug Something isn't working label Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant