Skip to content

Commit 499be65

Browse files
committed
Remove QuantumControlBase
1 parent 1e373ae commit 499be65

37 files changed

+3458
-105
lines changed

Project.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
88
IOCapture = "b5f81e59-6552-4d32-b1f0-c071b021bf89"
99
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
1010
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
11+
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
1112
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
12-
QuantumControlBase = "f10a33bc-5a64-497c-be7b-6f86b4f0c2aa"
13+
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
1314
QuantumPropagators = "7bf12567-5742-4b91-a078-644e72a65fc1"
1415
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
1516

@@ -26,7 +27,9 @@ FileIO = "1"
2627
FiniteDifferences = "0.12"
2728
IOCapture = "0.2.4"
2829
JLD2 = "0.4"
29-
QuantumControlBase = ">=0.10.0"
30+
LinearAlgebra = "1"
31+
Logging = "1"
32+
Printf = "1"
3033
QuantumPropagators = ">=0.8.0"
3134
Zygote = "0.6"
3235
julia = "1.9"

docs/generate_api.jl

Lines changed: 81 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,23 @@ end
5959

6060
quantum_control_members = [
6161
m for m in names(QuantumControl)
62-
if m :QuantumControl
62+
if (m :QuantumControl) && (m QuantumControl.DEPRECATED)
6363
]
6464

65-
quantum_control_local_members = get_local_members(QuantumControl, all=false)
65+
quantum_control_local_members = filter(
66+
member -> member QuantumControl.DEPRECATED,
67+
get_local_members(QuantumControl, all=false)
68+
)
6669

6770
quantum_control_reexported_members = [
68-
m for m in quantum_control_members
69-
if m quantum_control_local_members
71+
m for m in quantum_control_members if m quantum_control_local_members
7072
]
7173

7274
quantum_control_sub_modules = get_submodules(QuantumControl)
7375

7476

7577
subpackages = [
7678
(:QuantumPropagators, "quantum_propagators.md"),
77-
(:QuantumControlBase, "quantum_control_base.md"),
7879
]
7980

8081

@@ -84,20 +85,27 @@ open(outfile, "w") do out
8485
write(out, "```@meta\n")
8586
write(out, "EditURL = \"../../generate_api.jl\"\n")
8687
write(out, "```\n\n")
87-
write(out, "# [QuantumControl](@id QuantumControlAPI)\n\n")
88-
_quantum_control_local_members = filter(
89-
member -> !(member in QuantumControl.DEPRECATED),
90-
quantum_control_local_members
91-
)
92-
if length(_quantum_control_local_members) > 0
93-
error("QuantumControl has local members. We don't want this")
94-
end
88+
write(out, "# [QuantumControl Public API](@id QuantumControlAPI)\n\n")
9589
write(out, """
90+
This page summarizes the public API of the `QuantumControl` package. See
91+
also the [Index](@ref API-Index) of *all* symbols.
92+
93+
QuantumControl exports the following symbols:
9694
97-
QuantumControl (re-)exports the following symbols:
95+
""")
96+
for name quantum_control_local_members
97+
obj = getfield(QuantumControl, name)
98+
ref = canonical_name(obj)
99+
println(out, "* [`$name`](@ref $ref)")
100+
end
98101

102+
write(out, """
99103
104+
and re-exports the following symbols either from its own
105+
[submodules](@ref public_submodules) or from
106+
[`QuantumPropagators`](@ref QuantumPropagatorsPackage):
100107
""")
108+
101109
for name quantum_control_reexported_members
102110
obj = getfield(QuantumControl, name)
103111
ref = canonical_name(obj)
@@ -106,13 +114,24 @@ open(outfile, "w") do out
106114

107115
write(out, """
108116
109-
It also defines the following unexported functions:
117+
It also defines the following public, but unexported functions:
110118
111119
* [`QuantumControl.set_default_ad_framework`](@ref)
112-
* [`QuantumControl.print_versions`](@ref)
113120
114121
""")
115122

123+
write(out, """
124+
### [Submodules](@id public_submodules)
125+
126+
Each of the following submodules defines their own public API. Note that
127+
some of these submodules are re-exported from or extend submodules of
128+
[`QuantumPropagators`](@ref QuantumPropagatorsPackage).
129+
130+
""")
131+
for submod in quantum_control_sub_modules
132+
write(out, "* [`QuantumControl.$(submod)`](@ref QuantumControl$(submod)API)\n")
133+
end
134+
116135
for submod in quantum_control_sub_modules
117136
write(out, "\n\n### [`QuantumControl.$submod`](@id QuantumControl$(submod)API)\n\n")
118137
for name in names(getfield(QuantumControl, submod))
@@ -140,8 +159,6 @@ open(outfile, "w") do out
140159
end
141160

142161

143-
local_submodules = [:Functionals, :PulseParameterizations, :Workflows]
144-
145162
local_module_api_id(mod) = replace("$mod", "." => "") * "LocalAPI"
146163

147164
function write_module_api(out, mod, description="")
@@ -178,14 +195,14 @@ function write_module_api(out, mod, description="")
178195
write(out, "\n\n")
179196
end
180197
if length(public_members) > 0
181-
write(out, "\nPublic Members:\n\n")
198+
write(out, "\nPublic Symbols:\n\n")
182199
for name public_members
183200
println(out, "* [`$name`](@ref $mod.$name)")
184201
end
185202
write(out, "\n")
186203
end
187204
if length(reexported_members) > 0
188-
write(out, "\nRe-exported Members:\n\n")
205+
write(out, "\nRe-exported Symbols:\n\n")
189206
for name reexported_members
190207
obj = getfield(mod, name)
191208
ref = canonical_name(obj)
@@ -194,22 +211,22 @@ function write_module_api(out, mod, description="")
194211
write(out, "\n")
195212
end
196213
if length(documented_private_members) > 0
197-
write(out, "\nPrivate Members:\n")
214+
write(out, "\nPrivate Symbols:\n")
198215
for name documented_private_members
199216
println(out, "* [`$name`](@ref $mod.$name)")
200217
end
201218
write(out, "\n")
202219
end
203220
if length(public_members) > 0
204-
write(out, "\n\n#### Public members\n\n")
221+
write(out, "\n\n#### Public Symbols\n\n")
205222
println(out, "```@docs")
206223
for name public_members
207224
println(out, "$mod.$name")
208225
end
209226
println(out, "```")
210227
end
211228
if length(documented_private_members) > 0
212-
write(out, "\n\n#### Private members\n\n")
229+
write(out, "\n\n#### Private Symbols\n\n")
213230
println(out, "```@docs")
214231
for name documented_private_members
215232
println(out, "$mod.$name")
@@ -220,52 +237,67 @@ function write_module_api(out, mod, description="")
220237
end
221238

222239

223-
outfile = joinpath(@__DIR__, "src", "api", "quantum_control_reference.md")
240+
outfile = joinpath(@__DIR__, "src", "api", "reference.md")
224241
println("Generating local reference for QuantumControl in $outfile")
225242
open(outfile, "w") do out
226243
write(out, "```@meta\n")
227244
write(out, "EditURL = \"../../generate_api.jl\"\n")
228245
write(out, "```\n\n")
229246
write(out, raw"""
230-
# Local Submodules
247+
# API Reference
231248
232-
The following submodules of `QuantumControl` are defined *locally* (as
233-
opposed to being re-exported from sub-packages).
249+
This page provides *all* docstrings locally defined in the `QuantumControl`
250+
package for both private and public symbols. See also the summary of the
251+
[public API](@ref QuantumControlAPI).
234252
235-
``\gdef\tgt{\text{tgt}}``
236-
``\gdef\tr{\operatorname{tr}}``
237-
``\gdef\Re{\operatorname{Re}}``
238-
``\gdef\Im{\operatorname{Im}}``
239-
""")
240-
for name in local_submodules
241-
write(out, "* [`QuantumControl.$name`](#$(local_module_api_id(getfield(QuantumControl, name))))\n")
242-
end
243-
write(out, raw"""
253+
`QuantumControl` exposes local [exported](#quantumcontrol-local-symbols)
254+
and [unexported](#quantumcontrol-local-unexported-symbols) local symbols as
255+
well as re-exporting symbols and sub-modules from the
256+
[QuantumPropagators](@ref QuantumPropagatorsPackage) subpackage and some
257+
of its submodules.
244258
245-
`QuantumControl` also locally defines some unexported functions:
259+
The [`QuantumControl` submodules](@ref quantumcontrol-submodules) provide
260+
additional public functionality. Note that some of the most commonly
261+
used symbols from `QuantumControl`'s submodules may also be re-exported at
262+
the top-level (such as [`@optimize_or_load`](@ref) from the
263+
[`QuantumControl.Workflows`](@ref QuantumControlWorkflowsAPI) submodule).
246264
247-
* [`QuantumControl` local unexported functions](#quantumcontrol-local-functions)
265+
""")
266+
write(out, raw"""
248267
268+
## [Local Exported Symbols](@id #quantumcontrol-local-symbols)
249269
250270
""")
251-
for name in local_submodules
252-
write_module_api(out, getfield(QuantumControl, name))
271+
println(out, "```@docs")
272+
for name quantum_control_local_members
273+
println(out, "QuantumControl.$name")
253274
end
275+
println(out, "```")
254276
write(out, raw"""
255277
256-
## [`QuantumControl` local unexported functions](@id quantumcontrol-local-functions)
278+
## [Local Unexported Symbols](@id quantumcontrol-local-unexported-symbols)
257279
258280
```@docs
259281
QuantumControl.set_default_ad_framework
260-
QuantumControl.print_versions
261282
```
283+
""")
284+
write(out, raw"""
285+
``\gdef\tgt{\text{tgt}}``
286+
``\gdef\tr{\operatorname{tr}}``
287+
``\gdef\Re{\operatorname{Re}}``
288+
``\gdef\Im{\operatorname{Im}}``
262289
263-
```@example
264-
import QuantumControl
265-
QuantumControl.print_versions()
266-
```
290+
## [List of Submodules](@id quantumcontrol-submodules)
291+
292+
`QuantumControl` has the following sub-modules:
267293
268294
""")
295+
for name in quantum_control_sub_modules
296+
write(out, "* [`QuantumControl.$name`](#$(local_module_api_id(getfield(QuantumControl, name))))\n")
297+
end
298+
for name in quantum_control_sub_modules
299+
write_module_api(out, getfield(QuantumControl, name))
300+
end
269301
end
270302

271303

@@ -276,7 +308,7 @@ open(outfile, "w") do out
276308
write(out, "EditURL = \"../../generate_api.jl\"\n")
277309
write(out, "```\n\n")
278310
write(out, raw"""
279-
# API Index
311+
# [API Index](@id API-Index)
280312
281313
```@index
282314
```
@@ -320,13 +352,13 @@ for (pkgname::Symbol, outfilename) in subpackages
320352
""")
321353
write(out, "\n\n## [`$pkgname`](@id $(pkgname)API)\n\n")
322354
if length(public_members) > 0
323-
write(out, "\nPublic Members:\n\n")
355+
write(out, "\nPublic Symbols:\n\n")
324356
for name in public_members
325357
write(out, "* [`$name`](@ref $pkgname.$name)\n")
326358
end
327359
end
328360
if length(documented_private_members) > 0
329-
write(out, "\nPrivate Members:\n\n")
361+
write(out, "\nPrivate Symbols:\n\n")
330362
for name in documented_private_members
331363
write(out, "* [`$name`](@ref $pkgname.$name)\n")
332364
end

docs/make.jl

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ using Pkg
22

33
using Documenter
44
using QuantumPropagators
5-
using QuantumControlBase
65
using QuantumControl
76
using QuantumControl.Shapes
87
using QuantumControl.Functionals
@@ -25,6 +24,16 @@ if endswith(VERSION, "dev")
2524
DEV_OR_STABLE = "dev/"
2625
end
2726

27+
function org_inv(pkgname)
28+
objects_inv =
29+
joinpath(@__DIR__, "..", "..", "$pkgname.jl", "docs", "build", "objects.inv")
30+
if isfile(objects_inv)
31+
return ("https://juliaquantumcontrol.github.io/$pkgname.jl/dev/", objects_inv,)
32+
else
33+
return "https://juliaquantumcontrol.github.io/$pkgname.jl/$DEV_OR_STABLE"
34+
end
35+
end
36+
2837
links = InterLinks(
2938
"Julia" => (
3039
"https://docs.julialang.org/en/v1/",
@@ -36,10 +45,10 @@ links = InterLinks(
3645
joinpath(@__DIR__, "src", "inventories", "TimerOutputs.toml")
3746
),
3847
"Examples" => "https://juliaquantumcontrol.github.io/QuantumControlExamples.jl/$DEV_OR_STABLE",
39-
"Krotov" => "https://juliaquantumcontrol.github.io/Krotov.jl/$DEV_OR_STABLE",
40-
"GRAPE" => "https://juliaquantumcontrol.github.io/GRAPE.jl/$DEV_OR_STABLE",
41-
"QuantumPropagators" => "https://juliaquantumcontrol.github.io/QuantumPropagators.jl/$DEV_OR_STABLE",
42-
"QuantumGradientGenerators" => "https://juliaquantumcontrol.github.io/QuantumGradientGenerators.jl/$DEV_OR_STABLE",
48+
"Krotov" => org_inv("Krotov"),
49+
"GRAPE" => org_inv("GRAPE"),
50+
"QuantumPropagators" => org_inv("QuantumPropagators"),
51+
"QuantumGradientGenerators" => org_inv("QuantumGradientGenerators"),
4352
"ComponentArrays" => (
4453
"https://jonniedie.github.io/ComponentArrays.jl/stable/",
4554
"https://jonniedie.github.io/ComponentArrays.jl/stable/objects.inv",
@@ -84,7 +93,8 @@ makedocs(;
8493
"https://juliaquantumcontrol.github.io/QuantumControl.jl/dev/assets/topbar/topbar.js"
8594
),
8695
],
87-
footer="[$NAME.jl]($GITHUB) v$VERSION docs powered by [Documenter.jl](https://github.com/JuliaDocs/Documenter.jl)."
96+
footer="[$NAME.jl]($GITHUB) v$VERSION docs powered by [Documenter.jl](https://github.com/JuliaDocs/Documenter.jl).",
97+
size_threshold=1024 * 1024,
8898
),
8999
pages=[
90100
"Home" => "index.md",
@@ -95,11 +105,8 @@ makedocs(;
95105
"Examples" => "examples/index.md",
96106
"API" => [
97107
"QuantumControl" => "api/quantum_control.md",
98-
"Local Submodules" => "api/quantum_control_reference.md",
99-
"Subpackages" => [
100-
"QuantumPropagators" => "api/quantum_propagators.md",
101-
"QuantumControlBase" => "api/quantum_control_base.md",
102-
],
108+
"Reference" => "api/reference.md",
109+
"Subpackages" => ["QuantumPropagators" => "api/quantum_propagators.md",],
103110
"Externals" => "api_externals.md",
104111
"Index" => "api/quantum_control_index.md",
105112
],

docs/src/assets/topbar/topbar.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ document.addEventListener("DOMContentLoaded", function() {
1818
}
1919
var packages = [
2020
"QuantumPropagators.jl",
21-
"QuantumControlBase.jl",
2221
"QuantumGradientGenerators.jl",
2322
"ParameterizedQuantumControl.jl",
2423
"Krotov.jl",

docs/src/index.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@ Depth = 1
6262
```@contents
6363
Pages = [
6464
"api/quantum_propagators.md",
65-
"api/quantum_control_base.md",
66-
"api/krotov.md",
67-
"api/grape.md",
6865
]
6966
Depth = 1
7067
```

0 commit comments

Comments
 (0)