Skip to content

Declare public API (unlock downstream ExplicitImports allow-lists)#4669

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:declare-public-api-ei
Jun 26, 2026
Merged

Declare public API (unlock downstream ExplicitImports allow-lists)#4669
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:declare-public-api-ei

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Contributor

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_kwargs ignores for check_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 ones public here 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 by ModelingToolkitBase, lib/ModelingToolkitBase/src/variables.jl) — docstringed setter for a variable's initialization guess; the public counterpart of the already-public getdefault/setdefault. Added to the existing @public getdefault, setdefault, ... line.
  • ImperativeAffect (owned by ModelingToolkitBase, lib/ModelingToolkitBase/src/systems/imperative_affect.jl) — docstringed, user-facing callback-affect helper. Added to the existing @public SymbolicContinuousCallback, SymbolicDiscreteCallback line.

Both are declared with the existing @public (SciMLPublic) convention in ModelingToolkitBase. The @import_mtkbase macro in ModelingToolkit propagates this so the names are public from the top-level ModelingToolkit module too — which is what downstream EI checks against.

Verification (run locally)

  • Julia 1.12.6: after the change, Base.ispublic(ModelingToolkitBase, :setguess) == true and Base.ispublic(ModelingToolkit, :setguess) == true; same for ImperativeAffect; neither is exported in either module.
  • Julia 1.10.11 (LTS floor): ModelingToolkit + ModelingToolkitBase precompile and load cleanly; both names remain reachable. (@public/SciMLPublic is parse-safe and a no-op on 1.10.)
  • Runic: clean.

Skipped (vetted, not made public)

Of the originally-surveyed candidates, the rest are intentionally left alone:

Name Reason skipped
SymbolicContinuousCallback Already @public in ModelingToolkitBase (propagated to MTK).
SymbolicDiscreteCallback Already @public in ModelingToolkitBase.
getdefault Already @public in ModelingToolkitBase.
setdefault Already @public in ModelingToolkitBase.
isparameter Already @public in ModelingToolkitBase.
t_nounits Already @public in ModelingToolkitBase.
hasmetadata Not owned here — owned and exported by SymbolicUtils (already public).
value Not owned here — owned by Symbolics (re-exported). Declare upstream in Symbolics if needed.
Constant Not a top-level MTK name. It's DifferentiationInterface.Constant (used in linearization.jl) and a Moshi @data variant MissingGuessValue.Constant inside MTKBase; neither is a public MTK API name.

Downstream impact

Once released, downstream repos can drop the matching ei_kwargs ignore entries for ModelingToolkit.setguess and ModelingToolkit.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

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>
@ChrisRackauckas ChrisRackauckas marked this pull request as ready for review June 26, 2026 08:47
@ChrisRackauckas ChrisRackauckas merged commit f6c47dc into SciML:master Jun 26, 2026
65 of 89 checks passed
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.

2 participants