Skip to content

Commit e16d5f4

Browse files
authored
Add wheel command to pyproject-build commands (#305)
1 parent edbd657 commit e16d5f4

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ Available as `spin.cmds.build.*`:
126126

127127
```
128128
sdist 📦 Build a source distribution in `dist/`
129+
wheel 📦 Build a wheel distribution in `dist/`
129130
```
130131

131132
### [pip](https://pip.pypa.io) (Package Installer for Python)

example_pkg/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ package = 'example_pkg'
2929
"spin.cmds.meson.build",
3030
"spin.cmds.meson.test",
3131
"spin.cmds.build.sdist",
32+
"spin.cmds.build.wheel",
3233
]
3334
"Documentation" = [
3435
"spin.cmds.meson.docs"

spin/cmds/build.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,15 @@ def sdist(pyproject_build_args):
1313
spin sdist -- -x -n
1414
"""
1515
run(["pyproject-build", ".", "--sdist"] + list(pyproject_build_args))
16+
17+
18+
@click.command()
19+
@click.argument("pyproject-build-args", metavar="", nargs=-1)
20+
def wheel(pyproject_build_args):
21+
"""📦 Build a wheel distribution in `dist/`
22+
23+
Extra arguments are passed to `pyproject-build`, e.g.
24+
25+
spin wheel -- -x -n
26+
"""
27+
run(["pyproject-build", ".", "--wheel"] + list(pyproject_build_args))

spin/tests/test_build_cmds.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ def test_sdist(example_pkg):
116116
spin("sdist")
117117

118118

119+
def test_wheel(example_pkg):
120+
spin("wheel")
121+
wheel_file_list = list(Path("dist").glob("example_pkg-0.0.dev0-*.whl"))
122+
assert len(wheel_file_list) == 1, "Wheel file not created in dist/"
123+
124+
119125
def test_example(example_pkg):
120126
spin("example")
121127

0 commit comments

Comments
 (0)