OMMX Python SDK 3.0.x#

Note

Python SDK 3.0.0 contains breaking API changes. A migration guide is available in the Python SDK v2 to v3 Migration Guide.

3.0.0 Alpha 2#

Static Badge

See the GitHub Release above for full details. The following summarizes the main changes. This is a pre-release version. APIs may change before the final release.

⚠ Removal of the Constraint.id field (#806)#

The id field (along with the .id getter, set_id(), and id= constructor argument) is removed from Constraint and its variants (IndicatorConstraint / OneHotConstraint / Sos1Constraint / EvaluatedConstraint / SampledConstraint / RemovedConstraint). A constraint’s ID now exists only as the key of the dict[int, Constraint] passed to Instance.from_components.

# Before (2.5.1)
c = Constraint(function=x + y, equality=Constraint.EQUAL_TO_ZERO, id=5)
Instance.from_components(..., constraints=[c], ...)

# After (3.0.0a2)
c = Constraint(function=x + y, equality=Constraint.EQUAL_TO_ZERO)
Instance.from_components(..., constraints={5: c}, ...)

Global ID counters (next_constraint_id and friends) and per-constraint to_bytes / from_bytes are also removed. For full details and migration steps, see the Python SDK v2 to v3 Migration Guide.

πŸ†• First-class special constraint types (#789, #790, #795, #796, #798)#

In addition to regular constraints, the following three special constraint types are now first-class citizens β€” they can be passed to Instance.from_components via indicator_constraints= / one_hot_constraints= / sos1_constraints=, and corresponding *_constraints_df DataFrames are available on Solution / SampleSet.

For concrete usage, evaluation-result access, and the Indicator relax / restore workflow, see Special Constraints.

Accordingly, the legacy ConstraintHints / OneHot / Sos1 classes, the Instance.constraint_hints property, and the PySCIPOpt Adapter’s use_sos1 flag are removed.

⚠ removed_reason column split into a separate table (#796)#

In v2.5.1 Solution.constraints_df carried a removed_reason column. In v3.0.0a2 that column is split out into a separate Solution.removed_reasons_df table, which you can join on if you need the previous shape. The same change applies to SampleSet.

# Before (2.5.1)
df = solution.constraints_df  # contains a 'removed_reason' column

# After (3.0.0a2)
df = solution.constraints_df.join(solution.removed_reasons_df)

Corresponding *_removed_reasons_df accessors are also provided for Indicator, OneHot, and SOS1.

πŸ†• Adapter Capability Model (#790, #805, #810, #811, #814)#

Alongside the special constraint types, adapters now declare their own supported capabilities via an ADDITIONAL_CAPABILITIES class attribute. When super().__init__(instance) is called, any undeclared special constraint is automatically converted to regular constraints (Big-M for Indicator / SOS1, linear equality for OneHot) before the instance reaches the solver.

Existing OMMX Adapters must be updated for Python SDK 3.0.0 to call super().__init__(instance). Currently the PySCIPOpt Adapter declares support for Indicator and SOS1.

For details and the manual conversion APIs, see Adapter Capability Model and Conversions.

πŸ”„ numpy scalar support (#794)#

The Function constructor now accepts numpy.integer and numpy.floating values. In v2.5.1, Function(numpy.int64(3)) raised TypeError.

3.0.0 Alpha 1#

Static Badge

See the GitHub Release above for full details. The following summarizes the main changes. This is a pre-release version. APIs may change before the final release.

Complete Rust re-export of ommx.v1 and ommx.artifact types (#770, #771, #774, #775, #782)#

Python SDK 3.0.0 is fully based on Rust/PyO3. In 2.0.0, the core implementation was rewritten in Rust while Python wrapper classes remained for compatibility. In 3.0.0, those Python wrappers are removed entirely β€” all types in ommx.v1 and ommx.artifact are now direct re-exports from Rust, and the protobuf Python runtime dependency is eliminated. The .raw attribute that previously provided access to the underlying PyO3 implementation has also been removed.

Migration to Sphinx and ReadTheDocs hosting (#780, #785)#

In v2, the Sphinx-based API Reference and Jupyter Book-based documentation were each hosted on GitHub Pages. In v3, documentation has been fully migrated to Sphinx and is now hosted on ReadTheDocs. GitHub Pages will continue to host the documentation as of v2.5.1, but all future updates will be on ReadTheDocs only.