Skip to content

Commit 8712b00

Browse files
committed
Move to hatch-rs
1 parent c8dfb5a commit 8712b00

File tree

2 files changed

+35
-7
lines changed

2 files changed

+35
-7
lines changed

rust/Makefile.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ requirements: requirements-rs requirements-py ## setup project for development
2323

2424
.PHONY: build-py build-rs build dev
2525
build-py:
26-
maturin build
26+
python -m build -w -n
2727

2828
build-rs:
2929
make -C rust build

rust/pyproject.toml.jinja

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[build-system]
2-
requires = ["maturin>=1,<2"]
3-
build-backend = "maturin"
2+
requires = ["hatchling", "hatch-rs"]
3+
build-backend="hatchling.build"
44

55
[project]
66
name = "{{project_name_formatted}}"
@@ -35,9 +35,10 @@ develop = [
3535
"check-manifest",
3636
"cibuildwheel",
3737
"codespell>=2.4,<2.5",
38+
"hatch-rs",
39+
"hatchling",
3840
"mdformat>=0.7.22,<0.8",
3941
"mdformat-tables>=1",
40-
"maturin>=1,<2",
4142
"pytest",
4243
"pytest-cov",
4344
"ruff",
@@ -80,6 +81,8 @@ replace = 'version = "{new_version}"'
8081
[tool.check-manifest]
8182
ignore = [
8283
".copier-answers.yaml",
84+
"Cargo.toml",
85+
"Cargo.lock",
8386
"Makefile",
8487
"docs/**/*",
8588
"rust/.config/*",
@@ -102,7 +105,7 @@ rustup target add x86_64-unknown-linux-gnu
102105
rustup show
103106
"""
104107
environment = {PATH="$HOME/.cargo/bin:$PATH", CARGO_TERM_COLOR="always"}
105-
archs = "x86_64 aarch64"
108+
skip = "*i686 musllinux*"
106109

107110
[tool.cibuildwheel.macos]
108111
before-build = """
@@ -112,7 +115,7 @@ rustup target add x86_64-apple-darwin
112115
rustup show
113116
"""
114117
environment = {PATH="$HOME/.cargo/bin:$PATH", CARGO_TERM_COLOR="always", MACOS_DEPLOYMENT_TARGET=11.0}
115-
archs = "x86_64 arm64"
118+
archs = "arm64"
116119

117120
[tool.cibuildwheel.windows]
118121
before-build = """
@@ -122,7 +125,7 @@ rustup target add aarch64-pc-windows-msvc
122125
rustup show
123126
"""
124127
environment = {PATH="$UserProfile\\.cargo\bin;$PATH", CARGO_TERM_COLOR="always"}
125-
archs = "AMD64 ARM64"
128+
skip = "*win32 *arm_64"
126129

127130
[tool.coverage.run]
128131
branch = true
@@ -138,6 +141,31 @@ exclude_also = [
138141
ignore_errors = true
139142
fail_under = 50
140143

144+
[tool.hatch.build]
145+
artifacts = [
146+
"project/*.dll",
147+
"project/*.dylib",
148+
"project/*.so",
149+
]
150+
151+
[tool.hatch.build.sources]
152+
src = "/"
153+
154+
[tool.hatch.build.hooks.hatch-rs]
155+
verbose = true
156+
module = "{{module}}"
157+
path = "."
158+
159+
[tool.hatch.build.targets.sdist]
160+
packages = ["{{module}}", "/rust", "/src"]
161+
sources = ["."]
162+
163+
{# [tool.hatch.build.targets.sdist.force-include]
164+
"./src" = "src" #}
165+
166+
[tool.hatch.build.targets.wheel]
167+
packages = ["{{module}}"]
168+
141169
[tool.pytest.ini_options]
142170
addopts = ["-vvv", "--junitxml=junit.xml"]
143171
testpaths = "{{module}}/tests"

0 commit comments

Comments
 (0)