solverforge 0.7.0__tar.gz → 0.7.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {solverforge-0.7.0 → solverforge-0.7.2}/Cargo.lock +1 -1
- {solverforge-0.7.0 → solverforge-0.7.2}/Cargo.toml +1 -1
- {solverforge-0.7.0 → solverforge-0.7.2}/PKG-INFO +5 -5
- {solverforge-0.7.0 → solverforge-0.7.2}/README.md +4 -4
- {solverforge-0.7.0 → solverforge-0.7.2}/pyproject.toml +1 -1
- {solverforge-0.7.0 → solverforge-0.7.2}/python/solverforge/__init__.py +1 -1
- {solverforge-0.7.0 → solverforge-0.7.2}/src/bindings.rs +1 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/error.rs +18 -1
- {solverforge-0.7.0 → solverforge-0.7.2}/src/runtime/dynamic_provider.rs +24 -15
- {solverforge-0.7.0 → solverforge-0.7.2}/src/score.rs +1 -1
- {solverforge-0.7.0 → solverforge-0.7.2}/src/state/callback_view.rs +3 -5
- {solverforge-0.7.0 → solverforge-0.7.2}/LICENSE +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/python/solverforge/_native.pyi +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/python/solverforge/config.py +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/python/solverforge/console.py +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/python/solverforge/constraints.py +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/python/solverforge/decorators.py +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/python/solverforge/errors.py +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/python/solverforge/events.py +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/python/solverforge/fields.py +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/python/solverforge/groups.py +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/python/solverforge/joiner.py +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/python/solverforge/manager.py +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/python/solverforge/model.py +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/python/solverforge/py.typed +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/python/solverforge/score.py +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/python/solverforge/solver.py +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/python/solverforge/typing.py +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/python/solverforge/ui.py +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/rust-toolchain.toml +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/callbacks/call.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/callbacks/mod.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/callbacks/registry.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/callbacks/threading.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/config.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/constraints/compiled.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/constraints/compiled_dispatch_tests.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/constraints/evaluate.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/constraints/incremental.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/constraints/list_precedence.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/constraints/list_precedence_tests.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/constraints/matches.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/constraints/mod.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/constraints/state.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/constraints/stream_plan.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/descriptor/extractor.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/descriptor/mod.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/descriptor/variable.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/intern.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/lib.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/manager/candidate_trace.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/manager/events.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/manager/jobs.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/manager/mod.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/manager/provenance.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/proxy/entity.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/proxy/list.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/proxy/mod.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/proxy/solution.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/runtime/candidate_metric.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/runtime/dynamic_assignment_group.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/runtime/list_slots.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/runtime/mod.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/runtime/scalar_slots.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/schema/build.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/schema/compiled.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/schema/mod.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/schema/parse.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/schema/python.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/schema/runtime_plan.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/schema/types.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/schema/validate.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/solver/api.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/solver/console.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/solver/mod.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/solver/progress.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/solver/result.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/solver/solvable.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/state/clone.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/state/entity_table.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/state/marshal.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/state/mod.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/state/solution.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/state/variables.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/ui.rs +0 -0
- {solverforge-0.7.0 → solverforge-0.7.2}/src/value.rs +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: solverforge
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.2
|
|
4
4
|
Classifier: Development Status :: 3 - Alpha
|
|
5
5
|
Classifier: Intended Audience :: Developers
|
|
6
6
|
Classifier: Intended Audience :: Science/Research
|
|
@@ -51,12 +51,12 @@ requirements, and other APIs that are not part of this package.
|
|
|
51
51
|
|
|
52
52
|
## Installation
|
|
53
53
|
|
|
54
|
-
The package version prepared by this checkout is `solverforge` `0.7.
|
|
54
|
+
The package version prepared by this checkout is `solverforge` `0.7.2`, targeting
|
|
55
55
|
the published and registry-locked SolverForge Rust `0.23.0` dependency base.
|
|
56
56
|
Install the matching package after its Python release with:
|
|
57
57
|
|
|
58
58
|
```sh
|
|
59
|
-
python3.14 -m pip install "solverforge==0.7.
|
|
59
|
+
python3.14 -m pip install "solverforge==0.7.2"
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
The installable wheel contains the core `solverforge` package, native extension,
|
|
@@ -76,12 +76,12 @@ make deliveries-run PORT=7861
|
|
|
76
76
|
```
|
|
77
77
|
|
|
78
78
|
The same source-checkout examples can be run against the matching published
|
|
79
|
-
package once `0.7.
|
|
79
|
+
package once `0.7.2` is released, without `PYTHONPATH` or an editable checkout:
|
|
80
80
|
|
|
81
81
|
```sh
|
|
82
82
|
python3.14 -m venv .venv-examples
|
|
83
83
|
. .venv-examples/bin/activate
|
|
84
|
-
python -m pip install "solverforge[examples]==0.7.
|
|
84
|
+
python -m pip install "solverforge[examples]==0.7.2"
|
|
85
85
|
python examples/nqueens.py
|
|
86
86
|
python -m examples.solverforge_hospital
|
|
87
87
|
python -m examples.solverforge_deliveries
|
|
@@ -20,12 +20,12 @@ requirements, and other APIs that are not part of this package.
|
|
|
20
20
|
|
|
21
21
|
## Installation
|
|
22
22
|
|
|
23
|
-
The package version prepared by this checkout is `solverforge` `0.7.
|
|
23
|
+
The package version prepared by this checkout is `solverforge` `0.7.2`, targeting
|
|
24
24
|
the published and registry-locked SolverForge Rust `0.23.0` dependency base.
|
|
25
25
|
Install the matching package after its Python release with:
|
|
26
26
|
|
|
27
27
|
```sh
|
|
28
|
-
python3.14 -m pip install "solverforge==0.7.
|
|
28
|
+
python3.14 -m pip install "solverforge==0.7.2"
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
The installable wheel contains the core `solverforge` package, native extension,
|
|
@@ -45,12 +45,12 @@ make deliveries-run PORT=7861
|
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
The same source-checkout examples can be run against the matching published
|
|
48
|
-
package once `0.7.
|
|
48
|
+
package once `0.7.2` is released, without `PYTHONPATH` or an editable checkout:
|
|
49
49
|
|
|
50
50
|
```sh
|
|
51
51
|
python3.14 -m venv .venv-examples
|
|
52
52
|
. .venv-examples/bin/activate
|
|
53
|
-
python -m pip install "solverforge[examples]==0.7.
|
|
53
|
+
python -m pip install "solverforge[examples]==0.7.2"
|
|
54
54
|
python examples/nqueens.py
|
|
55
55
|
python -m examples.solverforge_hospital
|
|
56
56
|
python -m examples.solverforge_deliveries
|
|
@@ -12,6 +12,7 @@ fn init_console() {
|
|
|
12
12
|
|
|
13
13
|
#[pymodule(gil_used = false)]
|
|
14
14
|
fn _native(py: Python<'_>, module: &Bound<'_, PyModule>) -> PyResult<()> {
|
|
15
|
+
crate::error::install_callback_panic_hook();
|
|
15
16
|
module.add(
|
|
16
17
|
"NativeSolverError",
|
|
17
18
|
py.get_type::<crate::error::NativeSolverError>(),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
use std::any::Any;
|
|
2
|
-
use std::panic::panic_any;
|
|
2
|
+
use std::panic::{panic_any, set_hook, take_hook};
|
|
3
|
+
use std::sync::Once;
|
|
3
4
|
|
|
4
5
|
use pyo3::create_exception;
|
|
5
6
|
use pyo3::exceptions::PyRuntimeError;
|
|
@@ -23,6 +24,22 @@ pub fn panic_with_py_err<T>(error: PyErr) -> T {
|
|
|
23
24
|
panic_any(SolverPanicPayload::new(message, error))
|
|
24
25
|
}
|
|
25
26
|
|
|
27
|
+
/// Keeps std's default hook from printing `thread panicked at src/error.rs`
|
|
28
|
+
/// for a callback error unwinding through the solver. That panic only carries
|
|
29
|
+
/// the Python error to `panic_to_py_err` (or the retained job's failure
|
|
30
|
+
/// status), which reports it once; every other panic reaches the previous hook.
|
|
31
|
+
pub fn install_callback_panic_hook() {
|
|
32
|
+
static INSTALL: Once = Once::new();
|
|
33
|
+
INSTALL.call_once(|| {
|
|
34
|
+
let previous = take_hook();
|
|
35
|
+
set_hook(Box::new(move |info| {
|
|
36
|
+
if !info.payload().is::<SolverPanicPayload>() {
|
|
37
|
+
previous(info);
|
|
38
|
+
}
|
|
39
|
+
}));
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
26
43
|
pub fn panic_to_py_err(payload: Box<dyn Any + Send>) -> PyErr {
|
|
27
44
|
let payload = match payload.downcast::<SolverPanicPayload>() {
|
|
28
45
|
Ok(payload) => {
|
|
@@ -213,23 +213,20 @@ fn parse_edits(edits_any: &Bound<'_, PyAny>) -> PyResult<Vec<RawProviderEdit>> {
|
|
|
213
213
|
fn parse_edit(edit_any: &Bound<'_, PyAny>) -> PyResult<RawProviderEdit> {
|
|
214
214
|
let edit = edit_any.cast::<PyDict>()?;
|
|
215
215
|
let entity_object = edit.get_item("entity")?;
|
|
216
|
-
let entity_class = optional_dict_str(edit, "entity_class")?
|
|
216
|
+
let entity_class = match optional_dict_str(edit, "entity_class")?
|
|
217
217
|
.or(optional_dict_str(edit, "entity_type")?)
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
});
|
|
218
|
+
{
|
|
219
|
+
Some(class) => Some(class),
|
|
220
|
+
None => entity_marker(entity_object.as_ref(), "_solverforge_entity_class")?
|
|
221
|
+
.and_then(|value| value.extract::<String>().ok()),
|
|
222
|
+
};
|
|
224
223
|
let variable_name = required_dict_str(edit, "variable_name")?;
|
|
225
|
-
let entity_index = optional_dict_usize(edit, "entity_index")?
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
})
|
|
232
|
-
.ok_or_else(|| py_err("dynamic compound edit missing `entity_index` or `entity`"))?;
|
|
224
|
+
let entity_index = match optional_dict_usize(edit, "entity_index")? {
|
|
225
|
+
Some(index) => Some(index),
|
|
226
|
+
None => entity_marker(entity_object.as_ref(), "_solverforge_entity_index")?
|
|
227
|
+
.and_then(|value| value.extract::<usize>().ok()),
|
|
228
|
+
}
|
|
229
|
+
.ok_or_else(|| py_err("dynamic compound edit missing `entity_index` or `entity`"))?;
|
|
233
230
|
let to_value_any = edit
|
|
234
231
|
.get_item("to_value")?
|
|
235
232
|
.or(edit.get_item("value")?)
|
|
@@ -266,6 +263,18 @@ fn optional_dict_str(dict: &Bound<'_, PyDict>, key: &str) -> PyResult<Option<Str
|
|
|
266
263
|
.map(Option::flatten)
|
|
267
264
|
}
|
|
268
265
|
|
|
266
|
+
/// Reads a binding marker off an edit's entity object. A missing attribute
|
|
267
|
+
/// means no marker; any other error (a KeyboardInterrupt) propagates.
|
|
268
|
+
fn entity_marker<'py>(
|
|
269
|
+
entity: Option<&Bound<'py, PyAny>>,
|
|
270
|
+
name: &str,
|
|
271
|
+
) -> PyResult<Option<Bound<'py, PyAny>>> {
|
|
272
|
+
match entity {
|
|
273
|
+
Some(entity) => entity.getattr_opt(name),
|
|
274
|
+
None => Ok(None),
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
269
278
|
fn optional_dict_usize(dict: &Bound<'_, PyDict>, key: &str) -> PyResult<Option<usize>> {
|
|
270
279
|
dict.get_item(key)?
|
|
271
280
|
.map(|value| {
|
|
@@ -20,7 +20,7 @@ pub fn dynamic_score_from_native(value: &Bound<'_, PyAny>) -> PyResult<DynamicSc
|
|
|
20
20
|
if let Ok(levels) = value.cast::<PyTuple>() {
|
|
21
21
|
return dynamic_score_from_sequence(levels.iter());
|
|
22
22
|
}
|
|
23
|
-
if let
|
|
23
|
+
if let Some(method) = value.getattr_opt("to_native")? {
|
|
24
24
|
let native = method.call0()?;
|
|
25
25
|
if let Ok(dict) = native.cast::<PyDict>() {
|
|
26
26
|
return dynamic_score_from_dict(dict);
|
|
@@ -535,11 +535,9 @@ impl PythonCallbackView {
|
|
|
535
535
|
entity_schema.type_name.as_str(),
|
|
536
536
|
)?;
|
|
537
537
|
for (variable_index, variable) in entity_schema.variables.iter().enumerate() {
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
.is_ok()
|
|
542
|
-
{
|
|
538
|
+
// Only a missing attribute selects the plain name: any other error
|
|
539
|
+
// (a KeyboardInterrupt raised inside a descriptor) must propagate.
|
|
540
|
+
let attribute_name = if object_bound.get_type().hasattr(variable.name.as_str())? {
|
|
543
541
|
variable.storage_name.as_str()
|
|
544
542
|
} else {
|
|
545
543
|
variable.name.as_str()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|