| 475 | } // namespace |
| 476 | |
| 477 | PYBIND11_MODULE(_dds3, module) |
| 478 | { |
| 479 | module.doc() = "dds3 Python extension (MVP wrappers)"; |
| 480 | |
| 481 | // Register SolverContext class for context reuse |
| 482 | py::class_<SolverContext>( |
| 483 | module, |
| 484 | "SolverContext", |
| 485 | "A reusable solver context that maintains state across multiple solve operations.\n\n" |
| 486 | "Creating a single context and reusing it for multiple solve_board calls is more\n" |
| 487 | "efficient than creating a new context for each call.\n\n" |
| 488 | "Example:\n" |
| 489 | " context = dds3.SolverContext()\n" |
| 490 | " result1 = dds3.solve_board(deal1, context=context)\n" |
| 491 | " result2 = dds3.solve_board(deal2, context=context) # Reuses cached state\n") |
| 492 | .def(py::init<>(), "Create a new solver context."); |
| 493 | |
| 494 | register_solve_bindings(module); |
| 495 | register_table_bindings(module); |
| 496 | register_par_bindings(module); |
| 497 | register_calc_par_bindings(module); |
| 498 | |
| 499 | module.def("api_root", []() { |
| 500 | return "dds.hpp"; |
| 501 | }); |
| 502 | module.def("module_name", []() { |
| 503 | return "_dds3"; |
| 504 | }); |
| 505 | } |
nothing calls this directly
no test coverage detected