diff --git a/Cargo.toml b/Cargo.toml index 18cfec13..96e5ed52 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -83,5 +83,5 @@ tracing = "0.1" serial_test = "3" # Python bindings -pyo3 = { version = "0.24.2", features = ["extension-module", "generate-import-lib"] } -pyo3-async-runtimes = { version = "0.24", features = ["tokio-runtime"] } +pyo3 = { version = "0.28.2", features = ["extension-module", "generate-import-lib"] } +pyo3-async-runtimes = { version = "0.28", features = ["tokio-runtime"] } diff --git a/crates/bashkit-python/src/lib.rs b/crates/bashkit-python/src/lib.rs index c634f1eb..7bc57444 100644 --- a/crates/bashkit-python/src/lib.rs +++ b/crates/bashkit-python/src/lib.rs @@ -21,8 +21,8 @@ use tokio::sync::Mutex; // JSON <-> Python helpers // ============================================================================ -/// Convert serde_json::Value → PyObject -fn json_to_py(py: Python<'_>, val: &serde_json::Value) -> PyResult { +/// Convert serde_json::Value → Py +fn json_to_py(py: Python<'_>, val: &serde_json::Value) -> PyResult> { match val { serde_json::Value::Null => Ok(py.None()), serde_json::Value::Bool(b) => Ok(b.into_pyobject(py)?.to_owned().into_any().unbind()), @@ -37,7 +37,7 @@ fn json_to_py(py: Python<'_>, val: &serde_json::Value) -> PyResult { } serde_json::Value::String(s) => Ok(s.into_pyobject(py)?.into_any().unbind()), serde_json::Value::Array(arr) => { - let items: Vec = arr + let items: Vec> = arr .iter() .map(|v| json_to_py(py, v)) .collect::>()?; @@ -53,7 +53,7 @@ fn json_to_py(py: Python<'_>, val: &serde_json::Value) -> PyResult { } } -/// Convert PyObject → serde_json::Value (for schema dicts) +/// Convert Py → serde_json::Value (for schema dicts) #[allow(clippy::only_used_in_recursion)] fn py_to_json(py: Python<'_>, obj: &Bound<'_, pyo3::PyAny>) -> PyResult { if obj.is_none() { @@ -71,14 +71,14 @@ fn py_to_json(py: Python<'_>, obj: &Bound<'_, pyo3::PyAny>) -> PyResult() { return Ok(serde_json::Value::String(s)); } - if let Ok(list) = obj.downcast::() { + if let Ok(list) = obj.cast::() { let arr: Vec = list .iter() .map(|item| py_to_json(py, &item)) .collect::>()?; return Ok(serde_json::Value::Array(arr)); } - if let Ok(dict) = obj.downcast::() { + if let Ok(dict) = obj.cast::() { let mut map = serde_json::Map::new(); for (k, v) in dict.iter() { let key: String = k.extract()?; @@ -96,7 +96,7 @@ fn py_to_json(py: Python<'_>, obj: &Bound<'_, pyo3::PyAny>) -> PyResult pyo3::PyResult> { - Python::with_gil(|py| { + Python::attach(|py| { let dict = PyDict::new(py); dict.set_item("stdout", &self.stdout)?; dict.set_item("stderr", &self.stderr)?; @@ -332,7 +332,7 @@ struct PyToolEntry { name: String, description: String, schema: serde_json::Value, - callback: PyObject, + callback: Py, } /// Compose Python callbacks as bash builtins for multi-tool orchestration. @@ -370,7 +370,7 @@ pub struct ScriptedTool { impl ScriptedTool { /// Build a Rust ScriptedTool from stored Python config. - /// Each Python callback is wrapped via `Python::with_gil`. + /// Each Python callback is wrapped via `Python::attach`. fn build_rust_tool(&self) -> RustScriptedTool { let mut builder = RustScriptedTool::builder(&self.name); @@ -379,12 +379,12 @@ impl ScriptedTool { } for entry in &self.tools { - let py_cb = Python::with_gil(|py| entry.callback.clone_ref(py)); + let py_cb = Python::attach(|py| entry.callback.clone_ref(py)); let tool_name = entry.name.clone(); let callback = move |args: &ToolArgs| -> Result { - Python::with_gil(|py| { - let params = json_to_py(py, &args.params).map_err(|e| e.to_string())?; + Python::attach(|py| { + let params = json_to_py(py, &args.params).map_err(|e: PyErr| e.to_string())?; let stdin_arg = args.stdin.as_deref().map(|s| s.to_string()); let result = py_cb @@ -466,7 +466,7 @@ impl ScriptedTool { py: Python<'_>, name: String, description: String, - callback: PyObject, + callback: Py, schema: Option>, ) -> PyResult<()> { let schema_val = match schema { @@ -590,7 +590,7 @@ impl ScriptedTool { fn create_langchain_tool_spec() -> PyResult> { let tool = RustBashTool::default(); - Python::with_gil(|py| { + Python::attach(|py| { let dict = PyDict::new(py); dict.set_item("name", tool.name())?; dict.set_item("description", tool.description())?; diff --git a/supply-chain/config.toml b/supply-chain/config.toml index fbb2fec5..2a913745 100644 --- a/supply-chain/config.toml +++ b/supply-chain/config.toml @@ -538,10 +538,6 @@ criteria = "safe-to-deploy" version = "2.13.0" criteria = "safe-to-deploy" -[[exemptions.indoc]] -version = "2.0.7" -criteria = "safe-to-deploy" - [[exemptions.insta]] version = "1.46.3" criteria = "safe-to-run" @@ -666,10 +662,6 @@ criteria = "safe-to-deploy" version = "2.8.0" criteria = "safe-to-deploy" -[[exemptions.memoffset]] -version = "0.9.1" -criteria = "safe-to-deploy" - [[exemptions.mime]] version = "0.3.17" criteria = "safe-to-deploy" @@ -831,15 +823,11 @@ version = "1.10.0" criteria = "safe-to-run" [[exemptions.pyo3]] -version = "0.24.2" +version = "0.28.2" criteria = "safe-to-deploy" [[exemptions.pyo3-async-runtimes]] -version = "0.24.0" -criteria = "safe-to-deploy" - -[[exemptions.pyo3-build-config]] -version = "0.24.2" +version = "0.28.0" criteria = "safe-to-deploy" [[exemptions.pyo3-build-config]] @@ -847,15 +835,15 @@ version = "0.28.2" criteria = "safe-to-deploy" [[exemptions.pyo3-ffi]] -version = "0.24.2" +version = "0.28.2" criteria = "safe-to-deploy" [[exemptions.pyo3-macros]] -version = "0.24.2" +version = "0.28.2" criteria = "safe-to-deploy" [[exemptions.pyo3-macros-backend]] -version = "0.24.2" +version = "0.28.2" criteria = "safe-to-deploy" [[exemptions.python3-dll-a]] @@ -1334,10 +1322,6 @@ criteria = "safe-to-deploy" version = "1.3.0" criteria = "safe-to-deploy" -[[exemptions.unindent]] -version = "0.2.4" -criteria = "safe-to-deploy" - [[exemptions.untrusted]] version = "0.9.0" criteria = "safe-to-deploy"