Commit 7f25ce1
[AI] Curate the public API instead of blanket-reexporting dependencies (#1286)
* Curate the public API instead of blanket-reexporting dependencies
Every package in the monorepo `@reexport`ed its dependencies wholesale, so
`using Optimization` put 263 names in scope and `using OptimizationOptimJL` put
298 — none of which either package owned. 34 came from SciMLOperators
(`AddVector`, `BlockDiagonalOperator`, `update_coefficients!`), and the surface
included `DynamicalSDEFunction`, `DDEProblem` and `EigenvalueProblem`. Of the
263, the entire repo referenced 65.
OptimizationBase now `using`s SciMLBase/ADTypes/SciMLLogging and states its
public API in explicit `export` lists: its own types plus the problem/solution
API and the nine `Auto*` types a user needs. Optimization re-exports that
curated set and nothing else. The solver packages stop passing OptimizationBase
through and expose only their own solvers, so `using OptimizationOptimJL` now
means `LBFGS`, `BFGS`, `IPNewton` and friends. Users load `Optimization`
alongside the solver package, which is what the docs already showed everywhere
but one page.
Optimization 263 public, 0 owned -> 39
OptimizationBase 262 public, 6 owned -> 38
OptimizationOptimJL 298 public, 0 owned -> 36
Dropping the reexports exposed five defects they had been masking:
- OptimizationMOI and OptimizationIpopt use `ADTypes.AutoSymbolics` and
`ADTypes.AutoSparse` qualified without declaring ADTypes at all; they
compiled only because the reexport chain happened to bind the name.
- OptimizationCMAEvolutionStrategy imported the SciMLBase *module* from
OptimizationBase, and OptimizationLBFGSB took `ReturnCode` from there rather
than from SciMLBase, which owns it.
- OptimizationPyCMA marked `all_qualified_accesses_via_owners` as broken; it
passes once accesses go to their owners, so the marker is removed.
17 packages used `@SciMLMessage` without depending on SciMLLogging and now
declare it. `run_qa`'s reexport audit is satisfied without disabling it: the
nine glue packages allow exactly their backend module, the two umbrella
packages list their curated re-surface, and the remaining 18 need no
allow-list because they expose nothing they do not own.
Breaking: Optimization and OptimizationBase 5 -> 6, sublibraries by their
SemVer rule, with intra-monorepo compat bounds updated to match.
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014Uj4Pu1LKHYqLSTLfPYDPo
* docs: use OptimizationBase in the PyCMA example
Matches getting_started.md and the LBFGSB/PRIMA/Sophia pages. Addresses
review feedback on the pycma.md hunk.
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A9dFnCQK2GVSNTCJP6ZMG2
* docs: use OptimizationBase as the entry package throughout
The docs were split between `using Optimization` and `using OptimizationBase`,
with getting_started.md, lbfgsb.md, prima.md and sophia.md already on the
latter. Settle on OptimizationBase everywhere, per review feedback on the
pycma.md hunk.
names(Optimization) is names(OptimizationBase) plus the symbol :Optimization,
and solve/init/solve!/reinit!/AutoForwardDiff/OptimizationProblem resolve to
identical bindings in both, so this is behaviour-preserving.
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A9dFnCQK2GVSNTCJP6ZMG2
* docs: stop relying on the SciMLBase binding leaked by @reexport
`@reexport using SciMLBase` exported names(SciMLBase), which always contains
the symbol SciMLBase itself, so the module binding landed in every namespace
that did `using Optimization`. Curating the exports removes it, and the docs
were depending on it in two places:
- 21 `SciMLBase.OptimizationProblem`/`OptimizationFunction` calls, 18 of them
in executed @example blocks, which would throw UndefVarError and fail the
build (@example errors are not covered by the existing warnonly list).
OptimizationBase exports both names, so drop the qualification.
- 5 @docs entries under API/ naming SciMLBase types. No page sets
CurrentModule, so Documenter resolves them in Main; make.jl now binds
SciMLBase explicitly.
rosenbrock.md, linearandinteger.md and ode.md `using SciMLBase` for real and
are left as they are.
Verified on Julia 1.11: master binds SciMLBase and ADTypes for all four
entry-package x solver combinations tested, this branch binds neither.
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A9dFnCQK2GVSNTCJP6ZMG2
* docs: say which of Optimization/OptimizationBase to install
Every example now loads OptimizationBase, so README and the index install
instructions pointed at a package the docs never use. Both now lead with
OptimizationBase, and index.md gains a short section on the relationship.
`Optimization` re-exports OptimizationBase and adds nothing else — it pulls in
Logging/ConsoleProgressMonitor/TerminalLoggers/LoggingExtras but never
references them — so the new text says the two are interchangeable rather than
inventing a distinction between them.
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A9dFnCQK2GVSNTCJP6ZMG2
* OptimizationBase: drop the now-stale Reexport dependency
Removing every `@reexport` from OptimizationBase left Reexport in [deps] and
[compat] with no user, which fails Aqua's stale-dependency check. The
reexport check itself already passed; this is the leftover.
QA on OptimizationBase: 19 pass / 1 fail / 1 broken before, 20 pass / 1 broken
after. The remaining broken is `ei_broken = (:no_implicit_imports,)`, which is
already on master.
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A9dFnCQK2GVSNTCJP6ZMG2
* OptimizationLBFGSB: drop the now-stale OptimizationFunction import
`using SciMLBase: OptimizationStats, OptimizationFunction` predates this
branch, but on master `@reexport using OptimizationBase` re-exported every
name in names(OptimizationBase), OptimizationFunction among them — and
exporting a name counts as using it, so the import was not stale. Removing
the reexport orphans it, and ExplicitImports' no_stale_explicit_imports
errors. The name is used nowhere else in the package.
QA on OptimizationLBFGSB, Julia 1.11:
master: 18 pass, 2 fail (JET + reexports), 1 broken
before: 19 pass, 1 fail (JET), 1 error (stale import), 1 broken
after: 19 pass, 1 fail (JET), 1 broken
The remaining JET failure is byte-identical to master's (same 9 toplevel
errors, from the LBFGSB struct colliding with the LBFGSB package binding)
and is already tracked as a follow-up.
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A9dFnCQK2GVSNTCJP6ZMG2
---------
Co-authored-by: ChrisRackauckas-Claude <accounts@chrisrackauckas.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 7ba3fc0 commit 7f25ce1
141 files changed
Lines changed: 562 additions & 361 deletions
File tree
- docs
- src
- optimization_packages
- tutorials
- lib
- OptimizationAuglag
- src
- test/qa
- OptimizationBBO
- src
- test/qa
- OptimizationBase
- src
- test
- AD
- qa
- OptimizationCMAEvolutionStrategy
- src
- test
- qa
- OptimizationEvolutionary
- src
- test/qa
- OptimizationGCMAES
- src
- test/qa
- OptimizationIpopt
- src
- test
- qa
- OptimizationLBFGSB
- src
- test
- qa
- OptimizationMOI
- src
- test/qa
- OptimizationMadNLP
- src
- test
- qa
- OptimizationManopt
- src
- test/qa
- OptimizationMetaheuristics
- src
- test/qa
- OptimizationMultistartOptimization
- src
- test/qa
- OptimizationNLPModels
- src
- test/qa
- OptimizationNLopt
- src
- test/qa
- OptimizationNOMAD
- src
- test/qa
- OptimizationODE
- src
- test/qa
- OptimizationOptimJL
- src
- test
- qa
- OptimizationOptimisers
- src
- test
- qa
- OptimizationPRIMA
- test
- qa
- OptimizationPolyalgorithms
- src
- test/qa
- OptimizationPyCMA
- src
- test
- qa
- OptimizationQuadDIRECT
- src
- test/qa
- OptimizationSciPy
- src
- test/qa
- OptimizationSophia
- src
- test
- qa
- OptimizationSpeedMapping
- src
- test/qa
- SimpleOptimization
- src
- test/qa
- src
- test
- AD
- downstream
- qa
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | | - | |
52 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | | - | |
| 201 | + | |
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
2 | 5 | | |
3 | 6 | | |
4 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
39 | 53 | | |
40 | 54 | | |
41 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
0 commit comments