diff --git a/Cargo.lock b/Cargo.lock index 6017e8600..bb30ddd3a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1632,15 +1632,6 @@ dependencies = [ "serde_core", ] -[[package]] -name = "indoc" -version = "2.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706" -dependencies = [ - "rustversion", -] - [[package]] name = "is_terminal_polyfill" version = "1.70.2" @@ -1801,15 +1792,6 @@ dependencies = [ "libc", ] -[[package]] -name = "memoffset" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" -dependencies = [ - "autocfg", -] - [[package]] name = "minicov" version = "0.3.8" @@ -2227,34 +2209,21 @@ dependencies = [ "pumpkin-constraints", "pumpkin-solver", "pyo3", - "pyo3-build-config 0.28.3", + "pyo3-build-config", ] [[package]] name = "pyo3" -version = "0.25.1" +version = "0.28.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8970a78afe0628a3e3430376fc5fd76b6b45c4d43360ffd6cdd40bdde72b682a" +checksum = "91fd8e38a3b50ed1167fb981cd6fd60147e091784c427b8f7183a7ee32c31c12" dependencies = [ - "indoc", "libc", - "memoffset", "once_cell", "portable-atomic", - "pyo3-build-config 0.25.1", + "pyo3-build-config", "pyo3-ffi", "pyo3-macros", - "unindent", -] - -[[package]] -name = "pyo3-build-config" -version = "0.25.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "458eb0c55e7ece017adeba38f2248ff3ac615e53660d7c71a238d7d2a01c7598" -dependencies = [ - "once_cell", - "target-lexicon", ] [[package]] @@ -2268,19 +2237,19 @@ dependencies = [ [[package]] name = "pyo3-ffi" -version = "0.25.1" +version = "0.28.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7114fe5457c61b276ab77c5055f206295b812608083644a5c5b2640c3102565c" +checksum = "7f29e10af80b1f7ccaf7f69eace800a03ecd13e883acfacc1e5d0988605f651e" dependencies = [ "libc", - "pyo3-build-config 0.25.1", + "pyo3-build-config", ] [[package]] name = "pyo3-macros" -version = "0.25.1" +version = "0.28.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8725c0a622b374d6cb051d11a0983786448f7785336139c3c94f5aa6bef7e50" +checksum = "df6e520eff47c45997d2fc7dd8214b25dd1310918bbb2642156ef66a67f29813" dependencies = [ "proc-macro2", "pyo3-macros-backend", @@ -2290,13 +2259,13 @@ dependencies = [ [[package]] name = "pyo3-macros-backend" -version = "0.25.1" +version = "0.28.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4109984c22491085343c05b0dbc54ddc405c3cf7b4374fc533f5c3313a572ccc" +checksum = "c4cdc218d835738f81c2338f822078af45b4afdf8b2e33cbb5916f108b813acb" dependencies = [ "heck", "proc-macro2", - "pyo3-build-config 0.25.1", + "pyo3-build-config", "quote", "syn", ] @@ -2750,12 +2719,6 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" -[[package]] -name = "unindent" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3" - [[package]] name = "utf8parse" version = "0.2.2" diff --git a/pumpkin-solver-py/Cargo.toml b/pumpkin-solver-py/Cargo.toml index aae34d8fb..897e4772f 100644 --- a/pumpkin-solver-py/Cargo.toml +++ b/pumpkin-solver-py/Cargo.toml @@ -16,7 +16,7 @@ crate-type = ["cdylib"] doc = false [dependencies] -pyo3 = { version = "0.25.1", features= ["extension-module"] } +pyo3 = { version = "0.28.3", features= ["extension-module"] } pumpkin-solver = { version = "0.3.0", path = "../pumpkin-solver" } pumpkin-constraints = { version = "0.3.0", path = "../pumpkin-crates/constraints", features=["clap"] } pumpkin-conflict-resolvers = { version = "0.3.0", path = "../pumpkin-crates/conflict-resolvers/"} diff --git a/pumpkin-solver-py/src/constraints/globals.rs b/pumpkin-solver-py/src/constraints/globals.rs index f9649c512..75a3a9964 100644 --- a/pumpkin-solver-py/src/constraints/globals.rs +++ b/pumpkin-solver-py/src/constraints/globals.rs @@ -7,7 +7,7 @@ use crate::variables::*; macro_rules! python_constraint { ($name:ident : $constraint_func:ident { $($field:ident : $type:ty),+ $(,)? }) => { - #[pyclass] + #[pyclass(from_py_object)] #[derive(Clone)] pub(crate) struct $name { constraint_tag: Tag, diff --git a/pumpkin-solver-py/src/model.rs b/pumpkin-solver-py/src/model.rs index e35b41880..9137b3682 100644 --- a/pumpkin-solver-py/src/model.rs +++ b/pumpkin-solver-py/src/model.rs @@ -42,7 +42,7 @@ pub struct Model { brancher: PythonBrancher, } -#[pyclass] +#[pyclass(from_py_object)] #[derive(Clone, Debug)] pub struct Tag(pub ConstraintTag); diff --git a/pumpkin-solver-py/src/optimisation.rs b/pumpkin-solver-py/src/optimisation.rs index 429caa3d0..956553a69 100644 --- a/pumpkin-solver-py/src/optimisation.rs +++ b/pumpkin-solver-py/src/optimisation.rs @@ -2,7 +2,8 @@ use pyo3::prelude::*; use crate::result::Solution; -#[pyclass] +#[pyclass(from_py_object)] +#[derive(Clone)] pub enum OptimisationResult { /// The problem was solved to optimality, and the solution is an optimal one. Optimal(Solution), @@ -14,14 +15,14 @@ pub enum OptimisationResult { Unknown(), } -#[pyclass(eq, eq_int)] +#[pyclass(eq, eq_int, from_py_object)] #[derive(Clone, Copy, PartialEq, Eq)] pub enum Optimiser { LinearSatUnsat, LinearUnsatSat, } -#[pyclass(eq, eq_int)] +#[pyclass(eq, eq_int, from_py_object)] #[derive(Clone, Copy, PartialEq, Eq)] pub enum Direction { Minimise, diff --git a/pumpkin-solver-py/src/result.rs b/pumpkin-solver-py/src/result.rs index 3df37942a..b13c782a3 100644 --- a/pumpkin-solver-py/src/result.rs +++ b/pumpkin-solver-py/src/result.rs @@ -5,16 +5,18 @@ use crate::variables::BoolExpression; use crate::variables::IntExpression; use crate::variables::Predicate; -#[pyclass] +#[pyclass(from_py_object)] #[allow(clippy::large_enum_variant)] +#[derive(Clone)] pub enum SatisfactionResult { Satisfiable(Solution), Unsatisfiable(), Unknown(), } -#[pyclass] +#[pyclass(from_py_object)] #[allow(clippy::large_enum_variant)] +#[derive(Clone)] pub enum SatisfactionUnderAssumptionsResult { Satisfiable(Solution), UnsatisfiableUnderAssumptions(Vec), @@ -22,7 +24,7 @@ pub enum SatisfactionUnderAssumptionsResult { Unknown(), } -#[pyclass] +#[pyclass(from_py_object)] #[derive(Clone)] pub struct Solution(pumpkin_solver::core::results::Solution); diff --git a/pumpkin-solver-py/src/variables.rs b/pumpkin-solver-py/src/variables.rs index 6e9e81527..05b15a4ab 100644 --- a/pumpkin-solver-py/src/variables.rs +++ b/pumpkin-solver-py/src/variables.rs @@ -5,7 +5,7 @@ use pumpkin_solver::core::variables::Literal; use pumpkin_solver::core::variables::TransformableVariable; use pyo3::prelude::*; -#[pyclass(eq, hash, frozen)] +#[pyclass(eq, hash, frozen, from_py_object)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub struct IntExpression(pub AffineView); @@ -26,7 +26,7 @@ impl IntExpression { } } -#[pyclass(eq, hash, frozen)] +#[pyclass(eq, hash, frozen, from_py_object)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub struct BoolExpression(pub Literal); @@ -47,7 +47,7 @@ impl From for BoolExpression { } } -#[pyclass(eq, eq_int, hash, frozen)] +#[pyclass(eq, eq_int, hash, frozen, from_py_object)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub enum Comparator { NotEqual, @@ -56,7 +56,7 @@ pub enum Comparator { GreaterThanOrEqual, } -#[pyclass(eq, get_all, hash, frozen)] +#[pyclass(eq, get_all, hash, frozen, from_py_object)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub struct Predicate { pub variable: IntExpression,