Skip to content

Commit 580d68c

Browse files
authored
Merge pull request #58 from python-project-templates/tkp/hrs
Move to hatch-rs
2 parents 318169c + 1fdb227 commit 580d68c

File tree

7 files changed

+124
-59
lines changed

7 files changed

+124
-59
lines changed

.copier-answers.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier
2-
_commit: 2d0c192
2+
_commit: 56f5fb6
33
_src_path: https://github.com/python-project-templates/base.git
44
add_docs: true
55
add_extension: rust

.github/workflows/docs.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Publish Docs
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
permissions:
9+
contents: write
10+
jobs:
11+
docs:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions-ext/python/setup@main
16+
- uses: actions-ext/rust/setup@main
17+
- run: uv pip install .
18+
- run: uv pip install yardang
19+
- run: yardang build
20+
- uses: peaceiris/actions-gh-pages@v4
21+
with:
22+
publish_branch: gh-pages
23+
github_token: ${{ secrets.GITHUB_TOKEN }}
24+
publish_dir: docs/html

Cargo.lock

Lines changed: 64 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ crate-type = ["cdylib"]
1111

1212
[dependencies]
1313
python_template_rust = { path = "./rust", version = "*" }
14-
pyo3 = { version = "0.25", features = ["abi3-py39", "extension-module", "multiple-pymethods"] }
15-
strum = "0.27.2"
14+
pyo3 = { version = "0.22", features = ["abi3-py39", "extension-module", "multiple-pymethods"] }
15+
strum = "0.24.1"
1616

1717
[profile.release]
1818
panic = 'abort'

Makefile

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

pyproject.toml

Lines changed: 31 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>=0.1.4"]
3+
build-backend="hatchling.build"
44

55
[project]
66
name = "python-template-rust"
@@ -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,28 @@ 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 = "python_template_rust"
157+
path = "."
158+
159+
[tool.hatch.build.targets.sdist]
160+
packages = ["python_template_rust", "/rust", "/src"]
161+
sources = ["."]
162+
163+
[tool.hatch.build.targets.wheel]
164+
packages = ["python_template_rust"]
165+
141166
[tool.pytest.ini_options]
142167
addopts = ["-vvv", "--junitxml=junit.xml"]
143168
testpaths = "python_template_rust/tests"

0 commit comments

Comments
 (0)