59
59
60
60
quantum_control_members = [
61
61
m for m in names (QuantumControl)
62
- if m ≠ :QuantumControl
62
+ if ( m ≠ :QuantumControl ) && (m ∉ QuantumControl . DEPRECATED)
63
63
]
64
64
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
+ )
66
69
67
70
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
70
72
]
71
73
72
74
quantum_control_sub_modules = get_submodules (QuantumControl)
73
75
74
76
75
77
subpackages = [
76
78
(:QuantumPropagators , " quantum_propagators.md" ),
77
- (:QuantumControlBase , " quantum_control_base.md" ),
78
79
]
79
80
80
81
@@ -84,20 +85,27 @@ open(outfile, "w") do out
84
85
write (out, " ```@meta\n " )
85
86
write (out, " EditURL = \" ../../generate_api.jl\"\n " )
86
87
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 " )
95
89
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:
96
94
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
98
101
102
+ write (out, """
99
103
104
+ and re-exports the following symbols either from its own
105
+ [submodules](@ref public_submodules) or from
106
+ [`QuantumPropagators`](@ref QuantumPropagatorsPackage):
100
107
""" )
108
+
101
109
for name ∈ quantum_control_reexported_members
102
110
obj = getfield (QuantumControl, name)
103
111
ref = canonical_name (obj)
@@ -106,13 +114,24 @@ open(outfile, "w") do out
106
114
107
115
write (out, """
108
116
109
- It also defines the following unexported functions:
117
+ It also defines the following public, but unexported functions:
110
118
111
119
* [`QuantumControl.set_default_ad_framework`](@ref)
112
- * [`QuantumControl.print_versions`](@ref)
113
120
114
121
""" )
115
122
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
+
116
135
for submod in quantum_control_sub_modules
117
136
write (out, " \n\n ### [`QuantumControl.$submod `](@id QuantumControl$(submod) API)\n\n " )
118
137
for name in names (getfield (QuantumControl, submod))
@@ -140,8 +159,6 @@ open(outfile, "w") do out
140
159
end
141
160
142
161
143
- local_submodules = [:Functionals , :PulseParameterizations , :Workflows ]
144
-
145
162
local_module_api_id (mod) = replace (" $mod " , " ." => " " ) * " LocalAPI"
146
163
147
164
function write_module_api (out, mod, description= " " )
@@ -178,14 +195,14 @@ function write_module_api(out, mod, description="")
178
195
write (out, " \n\n " )
179
196
end
180
197
if length (public_members) > 0
181
- write (out, " \n Public Members :\n\n " )
198
+ write (out, " \n Public Symbols :\n\n " )
182
199
for name ∈ public_members
183
200
println (out, " * [`$name `](@ref $mod .$name )" )
184
201
end
185
202
write (out, " \n " )
186
203
end
187
204
if length (reexported_members) > 0
188
- write (out, " \n Re-exported Members :\n\n " )
205
+ write (out, " \n Re-exported Symbols :\n\n " )
189
206
for name ∈ reexported_members
190
207
obj = getfield (mod, name)
191
208
ref = canonical_name (obj)
@@ -194,22 +211,22 @@ function write_module_api(out, mod, description="")
194
211
write (out, " \n " )
195
212
end
196
213
if length (documented_private_members) > 0
197
- write (out, " \n Private Members :\n " )
214
+ write (out, " \n Private Symbols :\n " )
198
215
for name ∈ documented_private_members
199
216
println (out, " * [`$name `](@ref $mod .$name )" )
200
217
end
201
218
write (out, " \n " )
202
219
end
203
220
if length (public_members) > 0
204
- write (out, " \n\n #### Public members \n\n " )
221
+ write (out, " \n\n #### Public Symbols \n\n " )
205
222
println (out, " ```@docs" )
206
223
for name ∈ public_members
207
224
println (out, " $mod .$name " )
208
225
end
209
226
println (out, " ```" )
210
227
end
211
228
if length (documented_private_members) > 0
212
- write (out, " \n\n #### Private members \n\n " )
229
+ write (out, " \n\n #### Private Symbols \n\n " )
213
230
println (out, " ```@docs" )
214
231
for name ∈ documented_private_members
215
232
println (out, " $mod .$name " )
@@ -220,52 +237,67 @@ function write_module_api(out, mod, description="")
220
237
end
221
238
222
239
223
- outfile = joinpath (@__DIR__ , " src" , " api" , " quantum_control_reference .md" )
240
+ outfile = joinpath (@__DIR__ , " src" , " api" , " reference .md" )
224
241
println (" Generating local reference for QuantumControl in $outfile " )
225
242
open (outfile, " w" ) do out
226
243
write (out, " ```@meta\n " )
227
244
write (out, " EditURL = \" ../../generate_api.jl\"\n " )
228
245
write (out, " ```\n\n " )
229
246
write (out, raw """
230
- # Local Submodules
247
+ # API Reference
231
248
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).
234
252
235
- ``\g def\t gt{\t ext{tgt}}``
236
- ``\g def\t r{\o peratorname{tr}}``
237
- ``\g def\R e{\o peratorname{Re}}``
238
- ``\g def\I m{\o peratorname{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.
244
258
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).
246
264
247
- * [`QuantumControl` local unexported functions](#quantumcontrol-local-functions)
265
+ """ )
266
+ write (out, raw """
248
267
268
+ ## [Local Exported Symbols](@id #quantumcontrol-local-symbols)
249
269
250
270
""" )
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 " )
253
274
end
275
+ println (out, " ```" )
254
276
write (out, raw """
255
277
256
- ## [`QuantumControl` local unexported functions ](@id quantumcontrol-local-functions )
278
+ ## [Local Unexported Symbols ](@id quantumcontrol-local-unexported-symbols )
257
279
258
280
```@docs
259
281
QuantumControl.set_default_ad_framework
260
- QuantumControl.print_versions
261
282
```
283
+ """ )
284
+ write (out, raw """
285
+ ``\g def\t gt{\t ext{tgt}}``
286
+ ``\g def\t r{\o peratorname{tr}}``
287
+ ``\g def\R e{\o peratorname{Re}}``
288
+ ``\g def\I m{\o peratorname{Im}}``
262
289
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:
267
293
268
294
""" )
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
269
301
end
270
302
271
303
@@ -276,7 +308,7 @@ open(outfile, "w") do out
276
308
write (out, " EditURL = \" ../../generate_api.jl\"\n " )
277
309
write (out, " ```\n\n " )
278
310
write (out, raw """
279
- # API Index
311
+ # [ API Index](@id API-Index)
280
312
281
313
```@index
282
314
```
@@ -320,13 +352,13 @@ for (pkgname::Symbol, outfilename) in subpackages
320
352
""" )
321
353
write (out, " \n\n ## [`$pkgname `](@id $(pkgname) API)\n\n " )
322
354
if length (public_members) > 0
323
- write (out, " \n Public Members :\n\n " )
355
+ write (out, " \n Public Symbols :\n\n " )
324
356
for name in public_members
325
357
write (out, " * [`$name `](@ref $pkgname .$name )\n " )
326
358
end
327
359
end
328
360
if length (documented_private_members) > 0
329
- write (out, " \n Private Members :\n\n " )
361
+ write (out, " \n Private Symbols :\n\n " )
330
362
for name in documented_private_members
331
363
write (out, " * [`$name `](@ref $pkgname .$name )\n " )
332
364
end
0 commit comments