Skip to content

Handling errors via py bindings#411

Merged
alphaville merged 10 commits intodev/releasefrom
feature/409-pybindings-error-handling
Mar 28, 2026
Merged

Handling errors via py bindings#411
alphaville merged 10 commits intodev/releasefrom
feature/409-pybindings-error-handling

Conversation

@alphaville
Copy link
Copy Markdown
Owner

@alphaville alphaville commented Mar 27, 2026

Main Changes

The main change is that now when using the Python bindings, aka direct interface, the API mirrors the API of the TPC interface. In other words,

import rosenbrock

solver = rosenbrock.solver()
response = solver.run(p=[0.5, 8.5], initial_guess=[1, 2, 3, 4, 0])

and response is an instance of SolverResponse and should be handled as follows:

if response.is_ok():
    # SolverResponse
    result = response.get()
    print(result)
else:
    # SolverError
    error = response.get()
    print(type(error))

Associated Issues

Merge Dependencies

This will be merged into dev/release. It should rather be merged before #404.

Target versions

  • OpEn version 0.12.0
  • opengen version 0.11.0 (including breaking changes!)

Checklist

  • API documentation updated
  • Appropriate testing
  • Update CHANGELOG(s)
  • Update webpage documentation, if necessary
  • Bump versions (in CHANGELOG, Cargo.toml and VERSION), if necessary

- update unit tests
- and website docs
- and benchmarks
@alphaville alphaville added python issue related to python codegen Code generation test Unit tests labels Mar 27, 2026
@alphaville alphaville marked this pull request as ready for review March 28, 2026 00:37
@alphaville alphaville merged commit b86f3f2 into dev/release Mar 28, 2026
@alphaville alphaville deleted the feature/409-pybindings-error-handling branch March 30, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codegen Code generation python issue related to python test Unit tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant