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

[feature] option for cleaning up build artefacts and directories #610

Closed
con-f-use opened this issue Apr 30, 2023 · 5 comments
Closed

[feature] option for cleaning up build artefacts and directories #610

con-f-use opened this issue Apr 30, 2023 · 5 comments

Comments

@con-f-use
Copy link

con-f-use commented Apr 30, 2023

Build creates several files and directories in the project dirs, some of them intermediate. Manual cleanup e.g. with something like rm -rf src/*.egg-info/ ./dist/ ./build/ can get tedious, because the command is hard to remember and because what actually gets created by build might be subject to change. Can we get a pyproject-build --clean and --clean-all option? The former would leave the resulting wheels and/or source distributions, while the latter removes everything including the dist directory.

Could be combined with #455 to clean before building, when are provided like so: pyproject-build --clean-all --wheel.

"clear" instead of "clean" might be an option name to consider, as e.g. venv uses it in that context and consistency is cozy and nice.

@con-f-use con-f-use changed the title [feature request] option for cleaning up build artefacts [feature] option for cleaning up build artefacts Apr 30, 2023
@con-f-use con-f-use changed the title [feature] option for cleaning up build artefacts [feature] option for cleaning up build artefacts and directories Apr 30, 2023
@henryiii
Copy link
Contributor

This is handed by the build backend. Setuptools happens to make those directories (.egg-info and build), but other build backends make different ones. Scikit-build-core actually allows a user to configure where build artifacts go, with build mildly recommended. Build can't safely clean up files it doesn't know about.

@con-f-use
Copy link
Author

Hmm... then the scope of the problem is "just" larger, right? To solve that correctly we'd need an interface between the build back- and frontend so that the frontend can trigger a cleanup by the backend.

@layday
Copy link
Member

layday commented May 1, 2023

I don't know if it's worth exposing a hook/param to purge the in-tree build cache. As far as I'm aware no other backend dumps its build cache in the source tree and is something that should be fixed by setuptools.

@layday
Copy link
Member

layday commented May 1, 2023

xref: pypa/setuptools#1871

@con-f-use
Copy link
Author

I don't know if it's worth exposing a hook/param to purge the in-tree build cache. As far as I'm aware no other backend dumps its build cache in the source tree and is something that should be fixed by setuptools.

Very much agreed, your earlier post was the first time it dawned on my that setuptools was the culprit. Thanks for taking the time of reading and answering. The only real usecase I can present was outlined in #455, their presence can cause unexpeted behavior and makes some task a bit more annoying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants