Declare public API (unlock downstream ExplicitImports allow-lists)#4669
Merged
ChrisRackauckas merged 1 commit intoJun 26, 2026
Merged
Conversation
Mark the docstringed, user-facing `setguess` and `ImperativeAffect` (both owned by ModelingToolkitBase) with `@public`. The `@import_mtkbase` macro in ModelingToolkit then propagates this to the top-level `ModelingToolkit` module, so downstream packages can drop their ExplicitImports allow-list entries for these names. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Declare public API (unlock downstream ExplicitImports allow-lists)
We've enabled the ExplicitImports QA check fleet-wide, and ~92 downstream repos carry allow-lists (
ei_kwargsignores forcheck_all_qualified_accesses_are_public/check_all_explicit_imports_are_public) ignoring non-public names that are accessed/imported from ModelingToolkit. The right fix is to mark the legitimately-public onespublichere so downstream can drop those ignores.This PR marks the two candidate names that are (a) defined in this monorepo, (b) genuinely user-facing API (docstringed), and (c) not already public/exported:
Made public
setguess(owned byModelingToolkitBase,lib/ModelingToolkitBase/src/variables.jl) — docstringed setter for a variable's initialization guess; the public counterpart of the already-publicgetdefault/setdefault. Added to the existing@public getdefault, setdefault, ...line.ImperativeAffect(owned byModelingToolkitBase,lib/ModelingToolkitBase/src/systems/imperative_affect.jl) — docstringed, user-facing callback-affect helper. Added to the existing@public SymbolicContinuousCallback, SymbolicDiscreteCallbackline.Both are declared with the existing
@public(SciMLPublic) convention inModelingToolkitBase. The@import_mtkbasemacro inModelingToolkitpropagates this so the names are public from the top-levelModelingToolkitmodule too — which is what downstream EI checks against.Verification (run locally)
Base.ispublic(ModelingToolkitBase, :setguess) == trueandBase.ispublic(ModelingToolkit, :setguess) == true; same forImperativeAffect; neither is exported in either module.ModelingToolkit+ModelingToolkitBaseprecompile and load cleanly; both names remain reachable. (@public/SciMLPublic is parse-safe and a no-op on 1.10.)Skipped (vetted, not made public)
Of the originally-surveyed candidates, the rest are intentionally left alone:
SymbolicContinuousCallback@publicinModelingToolkitBase(propagated to MTK).SymbolicDiscreteCallback@publicinModelingToolkitBase.getdefault@publicinModelingToolkitBase.setdefault@publicinModelingToolkitBase.isparameter@publicinModelingToolkitBase.t_nounits@publicinModelingToolkitBase.hasmetadataSymbolicUtils(already public).valueSymbolics(re-exported). Declare upstream in Symbolics if needed.ConstantDifferentiationInterface.Constant(used inlinearization.jl) and aMoshi @datavariantMissingGuessValue.Constantinside MTKBase; neither is a public MTK API name.Downstream impact
Once released, downstream repos can drop the matching
ei_kwargsignore entries forModelingToolkit.setguessandModelingToolkit.ImperativeAffect. The other ignores remain governed by their true owners (SymbolicUtils/Symbolics/etc.) or are already handled.Please ignore until reviewed by @ChrisRackauckas.
🤖 Generated with Claude Code