careful-controller-15791
04/03/2024, 8:42 AMbroad-processor-92400
04/03/2024, 9:16 AMfile(...)
target or similar (probably won't be a great experience, but might be first step)
• get something going with the shell_command
or adhoc_tool
targets
• use @gorgeous-winter-99296's plugin for rust/cargo: https://github.com/pantsbuild/pants/discussions/20119.
Using a proper plugin like the last will give the best experience, but I don't know how much support it has for tools like maturin, yet!gorgeous-winter-99296
04/03/2024, 9:19 AMcareful-controller-15791
04/03/2024, 9:46 AMshell_command
or adhoc_tool
to get a working proof of concept. We can then maybe look into adapting the cargo plugin or making a new plugin to handle this a bit cleanergorgeous-winter-99296
04/03/2024, 9:47 AMfresh-continent-76371
04/15/2024, 12:22 AMfresh-continent-76371
04/15/2024, 12:22 AMmodern-smartphone-82928
04/19/2024, 12:21 AM[build-system]
requires = ["maturin==1.5.0"]
build-backend = "maturin"
[tool.maturin]
features = [
"pyo3/extension-module",
]
The python_distribution is also parametrized with the following.
**parametrize("windows-gnu", env_vars = ["RUSTUP_HOME", "CARGO_BUILD_TARGET=x86_64-pc-windows-gnu"]),
**parametrize("linux", env_vars = ["RUSTUP_HOME", "CARGO_BUILD_TARGET=x86_64-unknown-linux-gnu"])
In our Cargo.toml
pyo3 = { version = "0.20.3", features = ["extension-module", "abi3-py310", "generate-import-lib"] }
producing wheels
<package>-cp310-abi3-linux_x86_64.whl
<package>-cp310-abi3-win_amd64.whl
Hope this helps.modern-smartphone-82928
04/19/2024, 12:26 AMmodern-smartphone-82928
04/19/2024, 12:28 AMcareful-controller-15791
10/14/2024, 2:41 PMfiles(
name="files_relust",
sources=["./Cargo.toml",
"./pyproject.toml",
"./Cargo.lock",
'./src/**/*.rs',],
)
adhoc_tool(
name="build_relust",
runnable="//:reqs#maturin",
description="A Rust library for Python",
execution_dependencies=[
"//:bash",
"//:reqs#maturin",
":files_relust",
"//:cargo",
"//:rustc",
],
args=["build", "--release", "-i", "python3.11"],
root_output_directory=".",
output_files=["./target/wheels/relust-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl"],
log_output=True,
)
I'm just struggling with installing the generated wheel file. This doesn't work because I can only use absolute paths
python_requirement(
name="relust",
requirements=["relust @ file://./target/wheels/relust-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl"],
dependencies=[":build_relust"],
modules=["relust"],
)
Should I implement a plugin similar to experimental_wrap_as_python_sources
to achieve this? Thanks a lot!!