Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e19d410

Browse filesBrowse files
lestevebetatim
andauthored
ENH Add minimal support for spin as a developer tool (#29012)
Co-authored-by: Tim Head <betatim@gmail.com>
1 parent 6f5dac0 commit e19d410
Copy full SHA for e19d410

File tree

2 files changed

+42
-0
lines changed
Filter options

2 files changed

+42
-0
lines changed

‎.spin/cmds.py

Copy file name to clipboard
+29Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import shutil
2+
import sys
3+
4+
import click
5+
from spin.cmds import util
6+
7+
8+
@click.command()
9+
def clean():
10+
"""🪥 Clean build folder.
11+
12+
Very rarely needed since meson-python recompiles as needed when sklearn is
13+
imported.
14+
15+
One known use case where "spin clean" is useful: avoid compilation errors
16+
when switching from numpy<2 to numpy>=2 in the same conda environment or
17+
virtualenv.
18+
"""
19+
util.run([sys.executable, "-m", "pip", "uninstall", "scikit-learn", "-y"])
20+
default_meson_build_dir = (
21+
f"build/cp{sys.version_info.major}{sys.version_info.minor}"
22+
)
23+
click.secho(
24+
f"removing default Meson build dir: {default_meson_build_dir}",
25+
bold=True,
26+
fg="bright_blue",
27+
)
28+
29+
shutil.rmtree(default_meson_build_dir, ignore_errors=True)

‎pyproject.toml

Copy file name to clipboardExpand all lines: pyproject.toml
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,3 +210,16 @@ exclude= '''
210210
sdist-only = []
211211
git-only = [".*", "asv_benchmarks", "azure-pipelines.yml", "benchmarks", "build_tools", "maint_tools"]
212212
default-ignore = false
213+
214+
[tool.spin]
215+
package = "sklearn" # name of your package
216+
217+
[tool.spin.commands]
218+
"Build" = [
219+
"spin.cmds.pip.install",
220+
"spin.cmds.meson.test",
221+
".spin/cmds.py:clean",
222+
]
223+
"Documentation" = [
224+
"spin.cmds.meson.docs"
225+
]

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.