Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
222 changes: 200 additions & 22 deletions pixi.lock

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@ channels = ["conda-forge"]
platforms = ["linux-64", "osx-arm64", "win-64"]

[tasks]
postinstall = "pip install --no-build-isolation --no-deps --disable-pip-version-check -e ."
# Build the Rust extension using maturin (config in pyproject.toml [tool.maturin])
build-rust = """
maturin build --release -m rust_ext/Cargo.toml \
&& pip install --force-reinstall rust_ext/target/wheels/*.whl \
&& cp $(python -c "import tabmat_rust_ext; print(tabmat_rust_ext.__file__.replace('__init__.py', 'tabmat_rust_ext.abi3.so'))") src/tabmat/tabmat_rust_ext/
"""
Comment on lines +9 to +12
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks a bit odd. Why is there a need to install the wheel and to copy the .so file?Doesn't maturing develop Just Work for now?

# Build only C++ extensions (skip Rust)
postinstall-cpp = "pip install --no-build-isolation --no-deps --disable-pip-version-check -e ."
# Full build: Rust extension first, then C++ extensions
postinstall = { cmd = "pip install --no-build-isolation --no-deps --disable-pip-version-check -e .", depends-on = ["build-rust"] }

[tasks.install-nightlies]
cmd = """
Expand Down Expand Up @@ -88,6 +97,8 @@ mako = "*"
setuptools = ">=62.0"
setuptools-scm = ">=8.1"
xsimd = "<11|>12.1"
rust = ">=1.70"
maturin = ">=1.0"
[target.unix.dependencies]
jemalloc-local = "*"

Expand Down
14 changes: 14 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,17 @@ before-all = [
"cmake -DCMAKE_INSTALL_PREFIX=/usr/local ..",
"make install"
]

# =============================================================================
# Maturin configuration for the Rust extension
# =============================================================================
# The Rust extension is built separately using maturin. This configuration
# tells maturin where to find the Cargo.toml and how to build the extension.
# Build with: maturin build --release -m rust_ext/Cargo.toml
# =============================================================================

[tool.maturin]
# Path to the Cargo.toml for the Rust extension
manifest-path = "rust_ext/Cargo.toml"
# Use stable ABI for Python 3.10+
features = ["pyo3/extension-module", "pyo3/abi3-py310"]
269 changes: 269 additions & 0 deletions rust_ext/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions rust_ext/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
name = "tabmat_rust_ext"
version = "0.1.0"
edition = "2021"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to start outdated.

Suggested change
edition = "2021"
edition = "2024"


[lib]
name = "tabmat_rust_ext"
crate-type = ["cdylib"]

[dependencies]
pyo3 = { version = "0.23", features = ["extension-module", "abi3-py310"] }
numpy = "0.23"

[profile.release]
lto = true
opt-level = 3
Loading
Loading