Dakota Python typing - use native JSON schemas + pyi stubs for thin package - #41
Draft
JavierGOrdonnez wants to merge 6 commits into
Draft
Conversation
dakota.environment is a compiled pybind11 module with no type info, so IDEs/type-checkers get nothing for it today. Generate stubs via pybind11-stubgen (scripts/generate_stubs.sh, make stubs), track them in stubs/, ship them next to the compiled extension via CMake install(), and warn (non-blocking) in CI when the committed stubs drift from the built module. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…wheel Dakota 6.24 accepts JSON input directly, and Dakota's own source already has a full Pydantic v2 model tree for it (dakota/python/dakota/spec — the same models that generate dakota.json and drive the C++ JSON parser codegen). It's pure Python with no compiled dependency, so install it alongside dakota.environment instead of asking users to consult Dakota's docs by hand: `from dakota.spec import DakotaStudy` now gets real validation plus IDE autocomplete/inline docs, and `DakotaStudy(...).model_dump(mode="json")` feeds directly into dakota.environment.study(callback, input_json). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
JavierGOrdonnez
marked this pull request as draft
August 11, 2026 14:08
JavierGOrdonnez
commented
Aug 11, 2026
Addresses PR ITISFoundation#41 review comments: callback was typing.Any (pybind11- stubgen can't see through the C++ py::object param), and callbacks was an unparameterized dict. Traced the real contract through Pybind11Interface::derived_map_ac (callback(kwargs) -> dict) and the dakota_python.cpp callbacks_map cast (dict[str, py::function] keyed by analysis-driver id), and added a DakotaCallback = Callable[[dict[str, Any]], dict[str, Any]] alias used by both overload pairs. Applied to scripts/generate_stubs.sh and the CI drift-check step so it's reproducible, not a one-off hand-edit; verified with pyright that a mismatched callback signature is now actually rejected. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…rGOrdonnez/itis-dakota into feat/dakota-spec-and-stubs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.