forked from scikit-learn/scikit-learn
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH Add minimal support for spin as a developer tool (scikit-learn#29012
) Co-authored-by: Tim Head <[email protected]>
- Loading branch information
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import shutil | ||
import sys | ||
|
||
import click | ||
from spin.cmds import util | ||
|
||
|
||
@click.command() | ||
def clean(): | ||
"""🪥 Clean build folder. | ||
Very rarely needed since meson-python recompiles as needed when sklearn is | ||
imported. | ||
One known use case where "spin clean" is useful: avoid compilation errors | ||
when switching from numpy<2 to numpy>=2 in the same conda environment or | ||
virtualenv. | ||
""" | ||
util.run([sys.executable, "-m", "pip", "uninstall", "scikit-learn", "-y"]) | ||
default_meson_build_dir = ( | ||
f"build/cp{sys.version_info.major}{sys.version_info.minor}" | ||
) | ||
click.secho( | ||
f"removing default Meson build dir: {default_meson_build_dir}", | ||
bold=True, | ||
fg="bright_blue", | ||
) | ||
|
||
shutil.rmtree(default_meson_build_dir, ignore_errors=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters