Skip to content

Commit f60c483

Browse files
aviralgarg05ignorant05
authored andcommitted
fix: replace deprecated PyO3 import_bound with import
Updates pyo3 from 0.22 to 0.24 and replaces all deprecated import_bound() calls with the new import() method. Fixes CI failure in PR #34.
1 parent 67d5a47 commit f60c483

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ resolver = "2"
55
[workspace.dependencies]
66
sled = "0.34"
77
sqlparser = "0.39"
8-
pyo3 = { version = "0.24.1", features = ["auto-initialize"] }
8+
pyo3 = { version = "0.24", features = ["auto-initialize"] }
99
anyhow = "1.0"
1010
thiserror = "1.0"
1111
tokio = { version = "1.35", features = ["full"] }

nexum_core/src/bridge/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ impl PythonBridge {
1313

1414
pub fn initialize(&mut self) -> Result<()> {
1515
Python::with_gil(|py| {
16-
let sys = py.import_bound("sys")?;
16+
let sys = py.import("sys")?;
1717
let path_attr = sys.getattr("path")?;
1818
let path = path_attr.downcast::<PyList>()?;
1919

@@ -36,7 +36,7 @@ impl PythonBridge {
3636
}
3737

3838
Python::with_gil(|py| {
39-
let nexum_ai = PyModule::import_bound(py, "nexum_ai.optimizer")?;
39+
let nexum_ai = PyModule::import(py, "nexum_ai.optimizer")?;
4040
let semantic_cache = nexum_ai.getattr("SemanticCache")?;
4141
let cache_instance = semantic_cache.call0()?;
4242

@@ -51,7 +51,7 @@ impl PythonBridge {
5151

5252
pub fn test_integration(&self) -> Result<String> {
5353
Python::with_gil(|py| {
54-
let nexum_ai = PyModule::import_bound(py, "nexum_ai.optimizer")?;
54+
let nexum_ai = PyModule::import(py, "nexum_ai.optimizer")?;
5555
let test_func = nexum_ai.getattr("test_vectorization")?;
5656
let result = test_func.call0()?;
5757
let result_str: String = result.str()?.extract()?;
@@ -72,7 +72,7 @@ impl SemanticCache {
7272
bridge.initialize()?;
7373

7474
let cache = Python::with_gil(|py| {
75-
let nexum_ai = PyModule::import_bound(py, "nexum_ai.optimizer")?;
75+
let nexum_ai = PyModule::import(py, "nexum_ai.optimizer")?;
7676
let semantic_cache_class = nexum_ai.getattr("SemanticCache")?;
7777
let cache_instance = semantic_cache_class.call0()?;
7878
Ok::<PyObject, PyErr>(cache_instance.unbind())
@@ -121,7 +121,7 @@ impl NLTranslator {
121121
bridge.initialize()?;
122122

123123
let translator = Python::with_gil(|py| {
124-
let nexum_ai = PyModule::import_bound(py, "nexum_ai.translator")?;
124+
let nexum_ai = PyModule::import(py, "nexum_ai.translator")?;
125125
let translator_class = nexum_ai.getattr("NLTranslator")?;
126126
let translator_instance = translator_class.call0()?;
127127
Ok::<PyObject, PyErr>(translator_instance.unbind())
@@ -152,7 +152,7 @@ mod tests {
152152
fn check_python_available() -> bool {
153153
let mut bridge = PythonBridge::new().unwrap();
154154
bridge.initialize().is_ok()
155-
&& Python::with_gil(|py| PyModule::import_bound(py, "nexum_ai.optimizer").is_ok())
155+
&& Python::with_gil(|py| PyModule::import(py, "nexum_ai.optimizer").is_ok())
156156
}
157157

158158
#[test]

0 commit comments

Comments
 (0)