From f7d288ba69f15dc896c839dad551c72f408c2058 Mon Sep 17 00:00:00 2001 From: haixuanTao Date: Thu, 28 Jul 2022 09:49:15 +0200 Subject: [PATCH] init `dora-node-api-python` --- Cargo.lock | 9 ++++++++- Cargo.toml | 1 + apis/python/node/Cargo.toml | 10 ++++++++++ apis/python/node/src/lib.rs | 15 +++++++++++++++ 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 apis/python/node/Cargo.toml create mode 100644 apis/python/node/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 52ad8549..88c7d6a8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -696,6 +696,14 @@ dependencies = [ "zenoh-config", ] +[[package]] +name = "dora-node-api-python" +version = "0.1.0" +dependencies = [ + "dora-node-api", + "pyo3", +] + [[package]] name = "dora-operator-api" version = "0.1.0" @@ -748,7 +756,6 @@ version = "0.1.0" dependencies = [ "opentelemetry", "opentelemetry-jaeger", - "tokio", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index a8e12adc..f7c977b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,7 @@ members = [ "apis/rust/operator", "apis/rust/operator/macros", "apis/python/binding", + "apis/python/node", "binaries/coordinator", "binaries/runtime", "libraries/extensions/message", diff --git a/apis/python/node/Cargo.toml b/apis/python/node/Cargo.toml new file mode 100644 index 00000000..0ebf4111 --- /dev/null +++ b/apis/python/node/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "dora-node-api-python" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +dora-node-api = { path = "../../rust/node" } +pyo3 = "0.16" diff --git a/apis/python/node/src/lib.rs b/apis/python/node/src/lib.rs new file mode 100644 index 00000000..3f487b5e --- /dev/null +++ b/apis/python/node/src/lib.rs @@ -0,0 +1,15 @@ +use dora_node_api::DoraNode; +use pyo3::prelude::*; + +#[pyclass] +#[repr(transparent)] +pub struct PyDoraNode { + pub node: DoraNode, +} + +/// This module is implemented in Rust. +#[pymodule] +fn wonnx(_py: Python, m: &PyModule) -> PyResult<()> { + m.add_class::().unwrap(); + Ok(()) +}