Skip to content

Commit

Permalink
chore(deps): bump pyo3 to 0.23.3
Browse files Browse the repository at this point in the history
  • Loading branch information
chrjabs committed Dec 11, 2024
1 parent c69e378 commit 801e272
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 26 deletions.
20 changes: 10 additions & 10 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions pyapi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ build = "build.rs"

[dependencies]
rustsat.workspace = true
pyo3 = { version = "0.22.5", features = [
pyo3 = { version = "0.23.3", features = [
"extension-module",
"abi3",
"abi3-py37",
] }

[build-dependencies]
pyo3-build-config = { version = "0.22.2" }
pyo3-build-config = { version = "0.23.3" }

[lib]
crate-type = ["cdylib"]
17 changes: 3 additions & 14 deletions pyapi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,12 @@ use crate::{
types::{Clause, Lit},
};

#[derive(IntoPyObject)]
pub(crate) enum SingleOrList<T> {
Single(T),
List(Vec<T>),
}

impl<T> IntoPy<PyObject> for SingleOrList<T>
where
T: IntoPy<PyObject>,
{
fn into_py(self, py: Python<'_>) -> PyObject {
match self {
SingleOrList::Single(single) => single.into_py(py),
SingleOrList::List(list) => list.into_py(py),
}
}
}

/// Python bindings for the RustSAT library
#[pymodule]
fn rustsat(py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> {
Expand All @@ -53,14 +42,14 @@ fn rustsat(py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add_class::<Cnf>()?;
m.add_class::<VarManager>()?;

let encodings = PyModule::new_bound(py, "rustsat.encodings")?;
let encodings = PyModule::new(py, "rustsat.encodings")?;
encodings.add_class::<Totalizer>()?;
encodings.add_class::<GeneralizedTotalizer>()?;
encodings.add_class::<DynamicPolyWatchdog>()?;
m.add("encodings", &encodings)?;

// To import encodings. Fix from https://github.com/PyO3/pyo3/issues/759
py.import_bound("sys")?
py.import("sys")?
.getattr("modules")?
.set_item("rustsat.encodings", &encodings)?;

Expand Down

0 comments on commit 801e272

Please sign in to comment.