-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
70 lines (64 loc) · 2.66 KB
/
Copy pathpyproject.toml
File metadata and controls
70 lines (64 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
[build-system]
requires = ["maturin>=1.7,<2"]
build-backend = "maturin"
[project]
name = "template-python-rust-cmd"
version = "0.1.0"
description = "Skeleton for a Python package backed by a Rust CLI and PyO3 bindings"
readme = "README.md"
requires-python = ">=3.11"
license = { text = "MIT" }
license-files = ["LICENSE"]
authors = [{ name = "Maintainer", email = "maintainer@example.com" }]
dependencies = []
# `template-cli` on PATH is the native cargo-built binary itself,
# injected into the wheel's <name>-<ver>.data/scripts/ directory by
# ci/build_wheel.py's post-processing step. No Python wrapper sits in
# front of it — `cmd → template-cli → stdout`. We don't use
# `[project.scripts]` (PEP 621 / wheel console-scripts), because on
# Windows pip generates a Python launcher .exe whose `os.execv` is
# emulated as CreateProcess + parent-exit, racing the shell prompt
# ahead of the child's stdout. See fbuild#747 and
# zackees/template-python-rust-cmd#2 (items 1 + 10).
[dependency-groups]
dev = [
"maturin>=1.7,<2",
"pytest>=8.0.0",
"ruff>=0.8.0",
]
[tool.maturin]
manifest-path = "crates/template-py/Cargo.toml"
module-name = "template_python_rust_cmd._native"
python-source = "src"
features = ["pyo3/extension-module"]
[tool.pytest.ini_options]
minversion = "8.0"
addopts = ["-ra", "--strict-markers"]
testpaths = ["tests"]
pythonpath = ["src"]
# Re-sync the editable install when these files change. Default uv
# only watches pyproject.toml, so editable installs silently leave a
# stale `_native.pyd` after .rs edits — `uv run` would then execute
# against pre-edit Rust code with no visible warning. The globs trigger
# re-sync on real source changes. Correctness, not raw speed, but the
# fast iteration loop depends on it. See fbuild#661 / #2 item (7).
[tool.uv]
cache-keys = [
{ file = "pyproject.toml" },
{ file = "Cargo.toml" },
{ file = "Cargo.lock" },
{ file = "rust-toolchain.toml" },
{ file = "crates/**/*.rs" },
{ file = "crates/**/Cargo.toml" },
]
# NOTE on `no-build-isolation-package`: fbuild disables PEP 517
# isolation so its setup.py-based mtime-skip can see the staged binary
# across `pip install` invocations. The maturin backend doesn't fit
# that pattern cleanly — disabling isolation breaks the build env's
# automatic maturin install (uv reuses a build env without maturin,
# and uv's preview `extra-build-dependencies` mechanism is fragile
# here). The CARGO_TARGET_DIR pin in ci/build_wheel.py already gives
# us the cargo-incremental win without needing to touch isolation,
# so we leave isolation on. See zackees/template-python-rust-cmd#2
# (item 5) — we may revisit if the maturin/uv combo grows a clean
# no-isolation story.