Select a model by name in a library carrying several - #5
Merged
Conversation
A leading string argument names the model — the name is the symbol
prefix its ABI functions are exported under, the same selection
spelling as CNLPModels.jl's CNLPModel(lib, :acopf, ...). Unambiguous,
since a model argument is never a string. A mistyped name is refused
at selection with the witness symbol named ({model}_nvar, which the
ABI requires of every model however it instantiates) instead of
surfacing as a raw ctypes undefined-symbol error several calls later;
schema() takes the same optional name, and lib() tolerates the @name
sigil spelling. Rebuilt on current master, whose string-spec
convention (@name vs path) already matched the Julia consumer — the
earlier version of this branch had re-implemented it from a stale
base.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
sshin23
force-pushed
the
anvil/model-selection
branch
from
August 13, 2026 04:56
8a96c8d to
3856751
Compare
sshin23
added a commit
that referenced
this pull request
Aug 13, 2026
One ruff finding (FURB188) in the sigil tolerance merged in #5; the merge landed before its CI leg reported. Co-Authored-By: Claude Fable 5 <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.
One shared library may export several models, each under its own symbol prefix with its own schema and instances — the multi-model form
ExaModelsC.compile_librarynow emits (madsuite-org/ExaModels.jl#308). Selecting byprefix=already worked; this adds the first-class selection spelling, mirroring CNLPModels.jl'sCNLPModel(lib, :acopf, ...)(madsuite-org/CNLPModels.jl#6):A leading string argument names the model (unambiguous — a model argument is never a string). A mistyped name is refused at selection with the witness symbol named —
{model}_nvar, which the ABI requires of every model however it instantiates — instead of surfacing as a raw ctypesundefined symbolseveral calls later. Giving both a model name and a disagreeingprefix=is aTypeError; omitting the name keeps the single-model spelling, so one-model libraries are unaffected.Tests cover selection of both fixture models (one-knob
tqand builder-onlysq) out of one library, instance independence across models, the refusal message, the conflict check, and per-model schemas; also verified against a compiled two-surface ExaModelsC library. Suite: 16 passed, 1 pre-existing environment skip.🤖 Generated with Claude Code