Skip to content

Dakota Python typing - use native JSON schemas + pyi stubs for thin package - #41

Draft
JavierGOrdonnez wants to merge 6 commits into
ITISFoundation:masterfrom
JavierGOrdonnez:feat/dakota-spec-and-stubs
Draft

Dakota Python typing - use native JSON schemas + pyi stubs for thin package#41
JavierGOrdonnez wants to merge 6 commits into
ITISFoundation:masterfrom
JavierGOrdonnez:feat/dakota-spec-and-stubs

Conversation

@JavierGOrdonnez

Copy link
Copy Markdown

No description provided.

Javier Garcia Ordonez and others added 2 commits August 10, 2026 00:34
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
JavierGOrdonnez marked this pull request as draft August 11, 2026 14:08
Comment thread stubs/dakota/environment/environment.pyi Outdated
Comment thread stubs/dakota/environment/environment.pyi Outdated
Javier Garcia Ordonez and others added 3 commits August 11, 2026 16:19
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant