spin 0.10__tar.gz → 0.12__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {spin-0.10/spin.egg-info → spin-0.12}/PKG-INFO +28 -13
- {spin-0.10 → spin-0.12}/README.md +26 -11
- {spin-0.10 → spin-0.12}/pyproject.toml +13 -5
- {spin-0.10 → spin-0.12}/spin/__init__.py +1 -1
- {spin-0.10 → spin-0.12}/spin/__main__.py +47 -10
- spin-0.12/spin/cmds/__init__.py +3 -0
- spin-0.12/spin/cmds/build.py +15 -0
- {spin-0.10 → spin-0.12}/spin/cmds/meson.py +142 -65
- spin-0.12/spin/cmds/meta.py +60 -0
- {spin-0.10 → spin-0.12}/spin/cmds/pip.py +7 -1
- {spin-0.10 → spin-0.12}/spin/cmds/util.py +9 -2
- {spin-0.10 → spin-0.12}/spin/color_format.py +1 -1
- {spin-0.10 → spin-0.12}/spin/tests/conftest.py +7 -0
- {spin-0.10 → spin-0.12}/spin/tests/test_build_cmds.py +28 -11
- {spin-0.10 → spin-0.12}/spin/tests/test_editable.py +0 -10
- spin-0.12/spin/tests/test_meson.py +109 -0
- spin-0.12/spin/tests/test_test.py +29 -0
- {spin-0.10 → spin-0.12}/spin/tests/testutil.py +4 -0
- {spin-0.10 → spin-0.12/spin.egg-info}/PKG-INFO +28 -13
- {spin-0.10 → spin-0.12}/spin.egg-info/SOURCES.txt +2 -0
- {spin-0.10 → spin-0.12}/spin.egg-info/requires.txt +1 -1
- spin-0.10/spin/cmds/__init__.py +0 -8
- spin-0.10/spin/cmds/build.py +0 -9
- spin-0.10/spin/tests/test_meson.py +0 -116
- {spin-0.10 → spin-0.12}/LICENSE +0 -0
- {spin-0.10 → spin-0.12}/setup.cfg +0 -0
- {spin-0.10 → spin-0.12}/spin/containers.py +0 -0
- {spin-0.10 → spin-0.12}/spin/sectioned_help.py +0 -0
- {spin-0.10 → spin-0.12}/spin/tests/test_cli.py +0 -0
- {spin-0.10 → spin-0.12}/spin.egg-info/dependency_links.txt +0 -0
- {spin-0.10 → spin-0.12}/spin.egg-info/entry_points.txt +0 -0
- {spin-0.10 → spin-0.12}/spin.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: spin
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.12
|
|
4
4
|
Summary: Developer tool for scientific Python libraries
|
|
5
5
|
Maintainer-email: Scientific Python <spin@discuss.scientific-python.org>
|
|
6
6
|
License: BSD 3-Clause License
|
|
@@ -55,7 +55,7 @@ Requires-Dist: tomli; python_version < "3.11"
|
|
|
55
55
|
Requires-Dist: colorama; platform_system == "Windows"
|
|
56
56
|
Requires-Dist: importlib_metadata>=7
|
|
57
57
|
Provides-Extra: lint
|
|
58
|
-
Requires-Dist: pre-commit==3.
|
|
58
|
+
Requires-Dist: pre-commit==3.8.0; extra == "lint"
|
|
59
59
|
Provides-Extra: dev
|
|
60
60
|
Requires-Dist: changelist==0.5; extra == "dev"
|
|
61
61
|
|
|
@@ -147,15 +147,15 @@ python -m spin
|
|
|
147
147
|
Available as `spin.cmds.meson.*`.
|
|
148
148
|
|
|
149
149
|
```
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
150
|
+
build 🔧 Build package with Meson/ninja
|
|
151
|
+
ipython 💻 Launch IPython shell with PYTHONPATH set
|
|
152
|
+
python 🐍 Launch Python shell with PYTHONPATH set
|
|
153
|
+
shell 💻 Launch shell with PYTHONPATH set
|
|
154
|
+
test 🔧 Run pytest
|
|
155
|
+
run 🏁 Run a shell command with PYTHONPATH set
|
|
156
|
+
docs 📖 Build Sphinx documentation
|
|
157
|
+
gdb 👾 Execute a Python snippet with GDB
|
|
158
|
+
lldb 👾 Execute a Python snippet with LLDB
|
|
159
159
|
```
|
|
160
160
|
|
|
161
161
|
### [Build](https://pypa-build.readthedocs.io/en/stable/) (PEP 517 builder)
|
|
@@ -163,7 +163,7 @@ Available as `spin.cmds.meson.*`.
|
|
|
163
163
|
Available as `spin.cmds.build.*`:
|
|
164
164
|
|
|
165
165
|
```
|
|
166
|
-
|
|
166
|
+
sdist 📦 Build a source distribution in `dist/`
|
|
167
167
|
```
|
|
168
168
|
|
|
169
169
|
### [pip](https://pip.pypa.io) (Package Installer for Python)
|
|
@@ -174,7 +174,15 @@ development workflow.
|
|
|
174
174
|
Available as `spin.cmds.pip.*`:
|
|
175
175
|
|
|
176
176
|
```
|
|
177
|
-
|
|
177
|
+
install 💽 Build and install package using pip.
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Meta (commands that operate on commands)
|
|
181
|
+
|
|
182
|
+
Available as `spin.cmds.meta.*`:
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
introspect 🔍 Print a command's location and source code
|
|
178
186
|
```
|
|
179
187
|
|
|
180
188
|
## 🧪 Custom commands
|
|
@@ -310,6 +318,13 @@ fc-cache -f -v
|
|
|
310
318
|
nox -s test
|
|
311
319
|
```
|
|
312
320
|
|
|
321
|
+
Other examples:
|
|
322
|
+
|
|
323
|
+
```
|
|
324
|
+
nox -s test -- -v
|
|
325
|
+
nox -s test -- -v spin/tests/test_meson.py
|
|
326
|
+
```
|
|
327
|
+
|
|
313
328
|
## History
|
|
314
329
|
|
|
315
330
|
The `dev.py` tool was [proposed for SciPy](https://github.com/scipy/scipy/issues/15489) by Ralf Gommers and [implemented](https://github.com/scipy/scipy/pull/15959) by Sayantika Banik, Eduardo Naufel Schettino, and Ralf Gommers (also see [Sayantika's blog post](https://labs.quansight.org/blog/the-evolution-of-the-scipy-developer-cli)).
|
|
@@ -86,15 +86,15 @@ python -m spin
|
|
|
86
86
|
Available as `spin.cmds.meson.*`.
|
|
87
87
|
|
|
88
88
|
```
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
89
|
+
build 🔧 Build package with Meson/ninja
|
|
90
|
+
ipython 💻 Launch IPython shell with PYTHONPATH set
|
|
91
|
+
python 🐍 Launch Python shell with PYTHONPATH set
|
|
92
|
+
shell 💻 Launch shell with PYTHONPATH set
|
|
93
|
+
test 🔧 Run pytest
|
|
94
|
+
run 🏁 Run a shell command with PYTHONPATH set
|
|
95
|
+
docs 📖 Build Sphinx documentation
|
|
96
|
+
gdb 👾 Execute a Python snippet with GDB
|
|
97
|
+
lldb 👾 Execute a Python snippet with LLDB
|
|
98
98
|
```
|
|
99
99
|
|
|
100
100
|
### [Build](https://pypa-build.readthedocs.io/en/stable/) (PEP 517 builder)
|
|
@@ -102,7 +102,7 @@ Available as `spin.cmds.meson.*`.
|
|
|
102
102
|
Available as `spin.cmds.build.*`:
|
|
103
103
|
|
|
104
104
|
```
|
|
105
|
-
|
|
105
|
+
sdist 📦 Build a source distribution in `dist/`
|
|
106
106
|
```
|
|
107
107
|
|
|
108
108
|
### [pip](https://pip.pypa.io) (Package Installer for Python)
|
|
@@ -113,7 +113,15 @@ development workflow.
|
|
|
113
113
|
Available as `spin.cmds.pip.*`:
|
|
114
114
|
|
|
115
115
|
```
|
|
116
|
-
|
|
116
|
+
install 💽 Build and install package using pip.
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Meta (commands that operate on commands)
|
|
120
|
+
|
|
121
|
+
Available as `spin.cmds.meta.*`:
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
introspect 🔍 Print a command's location and source code
|
|
117
125
|
```
|
|
118
126
|
|
|
119
127
|
## 🧪 Custom commands
|
|
@@ -249,6 +257,13 @@ fc-cache -f -v
|
|
|
249
257
|
nox -s test
|
|
250
258
|
```
|
|
251
259
|
|
|
260
|
+
Other examples:
|
|
261
|
+
|
|
262
|
+
```
|
|
263
|
+
nox -s test -- -v
|
|
264
|
+
nox -s test -- -v spin/tests/test_meson.py
|
|
265
|
+
```
|
|
266
|
+
|
|
252
267
|
## History
|
|
253
268
|
|
|
254
269
|
The `dev.py` tool was [proposed for SciPy](https://github.com/scipy/scipy/issues/15489) by Ralf Gommers and [implemented](https://github.com/scipy/scipy/pull/15959) by Sayantika Banik, Eduardo Naufel Schettino, and Ralf Gommers (also see [Sayantika's blog post](https://labs.quansight.org/blog/the-evolution-of-the-scipy-developer-cli)).
|
|
@@ -34,12 +34,15 @@ dynamic = ['version']
|
|
|
34
34
|
spin = "spin.__main__:main"
|
|
35
35
|
|
|
36
36
|
[project.optional-dependencies]
|
|
37
|
-
lint = ["pre-commit == 3.
|
|
37
|
+
lint = ["pre-commit == 3.8.0"]
|
|
38
38
|
dev = ["changelist == 0.5"]
|
|
39
39
|
|
|
40
40
|
[project.urls]
|
|
41
41
|
homepage = "https://github.com/scientific-python/spin"
|
|
42
42
|
|
|
43
|
+
[tool.changelist]
|
|
44
|
+
ignored_user_logins = ["dependabot[bot]", "pre-commit-ci[bot]", "web-flow"]
|
|
45
|
+
|
|
43
46
|
[tool.setuptools.dynamic.version]
|
|
44
47
|
attr = 'spin.__version__'
|
|
45
48
|
|
|
@@ -47,13 +50,13 @@ attr = 'spin.__version__'
|
|
|
47
50
|
include = ["spin*"]
|
|
48
51
|
|
|
49
52
|
[tool.pytest.ini_options]
|
|
53
|
+
minversion = "8.0"
|
|
54
|
+
addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config"]
|
|
55
|
+
xfail_strict = true
|
|
50
56
|
filterwarnings = [
|
|
51
57
|
"ignore:cannot collect 'test' because it is not a function:",
|
|
52
58
|
]
|
|
53
|
-
|
|
54
|
-
[tool.ruff]
|
|
55
|
-
line-length = 88
|
|
56
|
-
target-version = "py38"
|
|
59
|
+
log_cli_level = "info"
|
|
57
60
|
|
|
58
61
|
[tool.ruff.lint]
|
|
59
62
|
select = [
|
|
@@ -63,6 +66,11 @@ select = [
|
|
|
63
66
|
"W",
|
|
64
67
|
"B",
|
|
65
68
|
"I",
|
|
69
|
+
"C4",
|
|
70
|
+
"ISC",
|
|
71
|
+
"PGH",
|
|
66
72
|
"UP",
|
|
73
|
+
"FURB",
|
|
74
|
+
"PYI",
|
|
67
75
|
]
|
|
68
76
|
ignore = ["B006", "C901", "E501", "E722"]
|
|
@@ -2,9 +2,11 @@ import collections
|
|
|
2
2
|
import importlib
|
|
3
3
|
import importlib.util
|
|
4
4
|
import os
|
|
5
|
+
import pathlib
|
|
5
6
|
import sys
|
|
6
7
|
import textwrap
|
|
7
8
|
import traceback
|
|
9
|
+
from typing import Union
|
|
8
10
|
|
|
9
11
|
import click
|
|
10
12
|
|
|
@@ -19,8 +21,26 @@ if sys.version_info >= (3, 11):
|
|
|
19
21
|
else:
|
|
20
22
|
import tomli as tomllib
|
|
21
23
|
|
|
24
|
+
|
|
22
25
|
click.Context.formatter_class = ColorHelpFormatter
|
|
23
26
|
|
|
27
|
+
config_filenames = (
|
|
28
|
+
".spin.toml",
|
|
29
|
+
"spin.toml",
|
|
30
|
+
"pyproject.toml",
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _detect_config_dir(path: pathlib.Path) -> Union[pathlib.Path, None]:
|
|
35
|
+
path = path.resolve()
|
|
36
|
+
files = os.listdir(path)
|
|
37
|
+
if any(f in files for f in config_filenames):
|
|
38
|
+
return path
|
|
39
|
+
elif path.parent != path:
|
|
40
|
+
return _detect_config_dir(path.parent)
|
|
41
|
+
else:
|
|
42
|
+
return None
|
|
43
|
+
|
|
24
44
|
|
|
25
45
|
def main():
|
|
26
46
|
# Alias `spin help` to `spin --help`
|
|
@@ -38,15 +58,25 @@ def main():
|
|
|
38
58
|
|
|
39
59
|
toml_config = collections.ChainMap()
|
|
40
60
|
toml_config.maps.extend(
|
|
41
|
-
DotDict(cfg)
|
|
42
|
-
for filename in (
|
|
43
|
-
".spin.toml",
|
|
44
|
-
"spin.toml",
|
|
45
|
-
"pyproject.toml",
|
|
46
|
-
)
|
|
47
|
-
if (cfg := load_toml(filename))
|
|
61
|
+
DotDict(cfg) for filename in config_filenames if (cfg := load_toml(filename))
|
|
48
62
|
)
|
|
49
63
|
|
|
64
|
+
if not toml_config:
|
|
65
|
+
click.secho(
|
|
66
|
+
f"Could not load configuration from one of: {', '.join(config_filenames)}",
|
|
67
|
+
file=sys.stderr,
|
|
68
|
+
fg="red",
|
|
69
|
+
)
|
|
70
|
+
config_dir = _detect_config_dir(pathlib.Path("."))
|
|
71
|
+
if config_dir:
|
|
72
|
+
print()
|
|
73
|
+
print(
|
|
74
|
+
"Are you running `spin` from the correct directory? Perhaps you'd like to\n"
|
|
75
|
+
)
|
|
76
|
+
click.secho(f" $ cd {os.path.relpath(config_dir, '.')}\n")
|
|
77
|
+
print("and try again.")
|
|
78
|
+
sys.exit(1)
|
|
79
|
+
|
|
50
80
|
# Basic configuration validation
|
|
51
81
|
version_query = len(sys.argv) == 2 and (sys.argv[1] == "--version")
|
|
52
82
|
|
|
@@ -55,15 +85,18 @@ def main():
|
|
|
55
85
|
if "tool.spin" in toml_config:
|
|
56
86
|
spin_config = toml_config["tool.spin"]
|
|
57
87
|
if "tool.spin.commands" not in toml_config:
|
|
58
|
-
|
|
59
|
-
"Error: configuration is missing section [tool.spin.commands]\n"
|
|
88
|
+
click.secho(
|
|
89
|
+
"Error: configuration is missing section [tool.spin.commands]\n"
|
|
90
|
+
"See https://github.com/scientific-python/spin/blob/main/README.md\n",
|
|
60
91
|
file=sys.stderr,
|
|
92
|
+
fg="red",
|
|
61
93
|
)
|
|
62
94
|
else:
|
|
63
|
-
|
|
95
|
+
click.secho(
|
|
64
96
|
"Error: need valid configuration in [.spin.toml], [spin.toml], or [pyproject.toml]\n"
|
|
65
97
|
"See https://github.com/scientific-python/spin/blob/main/README.md\n",
|
|
66
98
|
file=sys.stderr,
|
|
99
|
+
fg="red",
|
|
67
100
|
)
|
|
68
101
|
|
|
69
102
|
proj_name = (
|
|
@@ -132,10 +165,14 @@ def main():
|
|
|
132
165
|
|
|
133
166
|
try:
|
|
134
167
|
cmd_func = getattr(mod, func)
|
|
168
|
+
cmd_func.module = mod # metadata for use by `introspect` command
|
|
135
169
|
except AttributeError:
|
|
136
170
|
print(f"!! Could not load command `{func}` from file `{path}`.\n")
|
|
137
171
|
continue
|
|
138
172
|
|
|
173
|
+
# Save command definition for use in `introspect`
|
|
174
|
+
cmd_func.spec = cmd
|
|
175
|
+
|
|
139
176
|
default_kwargs = cmd_default_kwargs.get(cmd)
|
|
140
177
|
import functools
|
|
141
178
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import click
|
|
2
|
+
|
|
3
|
+
from .util import run
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@click.command()
|
|
7
|
+
@click.argument("pyproject-build-args", metavar="", nargs=-1)
|
|
8
|
+
def sdist(pyproject_build_args):
|
|
9
|
+
"""📦 Build a source distribution in `dist/`
|
|
10
|
+
|
|
11
|
+
Extra arguments are passed to `pyproject-build`, e.g.
|
|
12
|
+
|
|
13
|
+
spin sdist -- -x -n
|
|
14
|
+
"""
|
|
15
|
+
run(["pyproject-build", ".", "--sdist"] + list(pyproject_build_args))
|