From 81f56a3a47b296369b512057601e031bf942ff0a Mon Sep 17 00:00:00 2001 From: Shayne Fletcher Date: Mon, 15 Dec 2025 19:29:51 -0800 Subject: [PATCH] : regualar rlib, not a python extension module Summary: convert `monarch_hyperactor` from `rust_python_library` to `rust_library` and add `extension-module` to `monarch_extension` `monarch_hyperactor` is not a Python extension module - it has no `#[pymodule]` entry point. the actual Python extension is `monarch_extension`, which depends on `monarch_hyperactor` and exposes its types to Python. this change converts `monarch_hyperactor` from `rust_python_library` to `rust_library`, removing the `dependencies_override`. it adds the `extension-module` feature to pyo3 in `monarch_extension` where it belongs, removes a non-functional `#[pymodule]` attribute from `monarch_hyperactor/src/channel.rs`, and removes incorrect dependencies from Python type stubs that were depending on `monarch_hyperactor` instead of `monarch_extension`. Differential Revision: D89247451 --- monarch_extension/Cargo.toml | 2 +- monarch_hyperactor/Cargo.toml | 2 +- monarch_hyperactor/src/channel.rs | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/monarch_extension/Cargo.toml b/monarch_extension/Cargo.toml index 26f90b908..a90b8b835 100644 --- a/monarch_extension/Cargo.toml +++ b/monarch_extension/Cargo.toml @@ -30,7 +30,7 @@ monarch_rdma_extension = { version = "0.0.0", path = "../monarch_rdma/extension" monarch_tensor_worker = { version = "0.0.0", path = "../monarch_tensor_worker", optional = true } nccl-sys = { path = "../nccl-sys", optional = true } ndslice = { version = "0.0.0", path = "../ndslice" } -pyo3 = { version = "0.24", features = ["anyhow", "multiple-pymethods", "py-clone"] } +pyo3 = { version = "0.24", features = ["anyhow", "extension-module", "multiple-pymethods"] } rdmaxcel-sys = { path = "../rdmaxcel-sys", optional = true } serde = { version = "1.0.219", features = ["derive", "rc"] } tokio = { version = "1.47.1", features = ["full", "test-util", "tracing"] } diff --git a/monarch_hyperactor/Cargo.toml b/monarch_hyperactor/Cargo.toml index 6ff3dc44b..b65d7a7a7 100644 --- a/monarch_hyperactor/Cargo.toml +++ b/monarch_hyperactor/Cargo.toml @@ -46,7 +46,7 @@ ndslice = { version = "0.0.0", path = "../ndslice" } nix = { version = "0.30.1", features = ["dir", "event", "hostname", "inotify", "ioctl", "mman", "mount", "net", "poll", "ptrace", "reboot", "resource", "sched", "signal", "term", "time", "user", "zerocopy"] } once_cell = "1.21" opentelemetry = "0.29" -pyo3 = { version = "0.24", features = ["anyhow", "multiple-pymethods"] } +pyo3 = { version = "0.24", features = ["anyhow", "multiple-pymethods", "py-clone"] } pyo3-async-runtimes = { version = "0.24", features = ["attributes", "tokio-runtime"] } serde = { version = "1.0.219", features = ["derive", "rc"] } serde_bytes = "0.11" diff --git a/monarch_hyperactor/src/channel.rs b/monarch_hyperactor/src/channel.rs index e3bdebdfe..ec31625d8 100644 --- a/monarch_hyperactor/src/channel.rs +++ b/monarch_hyperactor/src/channel.rs @@ -146,7 +146,6 @@ impl From for ChannelTransport { } } -#[pymodule] pub fn register_python_bindings(hyperactor_mod: &Bound<'_, PyModule>) -> PyResult<()> { hyperactor_mod.add_class::()?; hyperactor_mod.add_class::()?;