-
Notifications
You must be signed in to change notification settings - Fork 281
feat: add a --clean-cache
command to clean up locations specified at CIBW_CACHE_PATH
#2489
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for putting this together!
Signed-off-by: Henry Schreiner <[email protected]>
The one thought I had was could we check for something specific to make sure this is in fact a cibuildwheel cache dir? Just to protect for a mistake like setting the cache dir to something like $HOME. :) |
Do you mean we should check if Realistically, I think we'd have no defense against this unless we make the cache path non-configurable and drop the ability to set it via the |
I was thinking looking for a specific file or folder that would exist if it was cibuildwheel's cache. |
Right, we could include a sentinel |
That's a nice idea. Might save somebody's day. |
Co-authored-by: Henry Schreiner <[email protected]>
for more information, see https://pre-commit.ci
|
Should we also comply with https://arc.net/l/quote/bosrzvuf? Edit: quoting here, it says the following:
|
I'd be fine with that - I was tempted to add it but was a little hard in comments. FWIW, uv does not add this. |
@freakboy3742 I'm guessing that since Azure hasn't migrated "macOS-latest" to 15 yet, there's nothing we can do about the Azure Pipelines failures, since those are on 14? |
--clean-cache
command to clean up locations specified at CIBW_CACHE_PATH
--clean-cache
command to clean up locations specified at CIBW_CACHE_PATH
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
really nice job on this!
Azure started moving GitHub's response to the problem appears to be "yeah, looks like macOS-15 is broken; try using macOS-14 for now, and maybe it will be fixed in the next release". I've opened #2563 to switch the Azure image, and add some documentation about the problem. That documentation is hopefully temporary, but since I can't say for certain, it doesn't hurt to throw a paragraph in. |
As described in #2397, this PR adds a
--clean-cache
command to cleanCIBW_CACHE_PATH
. It does not implement granular cache cleans at the moment (it does not clean per supported platform), andshutil.rmtree()
s the entire folder. I added three tests that account for possible code paths: if cache files exist, if they don't, or if the cache files are somehow in a non-readable/writable location (though I think that aspect should also be validated at the creation time of the cache paths).This is especially useful for Pyodide builds, as the Emscripten SDK can occupy up to 1.5 GiB of space; however, it is also beneficial for builds on all other platforms.
Closes #2397