58
58
'pandas' : ('https://pandas.pydata.org/docs/' , None ),
59
59
'scikit-learn' : ('https://scikit-learn.org/stable/' , None ),
60
60
'scipy' : ('https://docs.scipy.org/doc/scipy/' , None ),
61
- 'Sphinx' : ('https://www.sphinx-doc.org/en/master/' , None ),
62
61
}
63
62
64
63
# -- General configuration ------------------------------------------------
84
83
'sphinx.ext.todo' ,
85
84
'sphinx_copybutton' ,
86
85
'enum_tools.autoenum' ,
87
- 'sphinx.ext.autosectionlabel' ,
88
- #'sphinx.ext.githubpages',
89
86
]
90
87
91
88
viewcode_follow_imported_members = True
108
105
109
106
# General information about the project.
110
107
project = u'Pyomo'
111
- copyright = u'2008-2023 , Sandia National Laboratories'
108
+ copyright = u'2008-2024 , Sandia National Laboratories'
112
109
author = u'Pyomo Developers'
113
110
114
111
# The version info for the project you're documenting, acts as replacement for
132
129
# List of patterns, relative to source directory, that match files and
133
130
# directories to ignore when looking for source files.
134
131
# This patterns also effect to html_static_path and html_extra_path
135
- exclude_patterns = ['_build' , 'Thumbs.db' , '.DS_Store' ]
132
+ # Notes:
133
+ # - _build : this is the Sphinx build (output) dir
134
+ #
135
+ # - api/*.tests.* : this matches autosummary RST files generated for
136
+ # test modules. Note that the _templates/recursive-modules.rst
137
+ # should prevent these file from being generated, so this is not
138
+ # strictly necessary, but including it makes Sphinx throw warnings if
139
+ # the filter in the template ever "breaks"
140
+ #
141
+ # - **/tests/** : this matches source files in any tests directory
142
+ # [JDS: I *believe* this is necessary, but am not 100% certain]
143
+ #
144
+ # - 'Thumbs.db', '.DS_Store' : these have been included from the
145
+ # beginning. Unclear if they are still necessary
146
+ exclude_patterns = ['_build' , 'api/*.tests.*' , '**/tests/**' , 'Thumbs.db' , '.DS_Store' ]
136
147
137
148
# The name of the Pygments (syntax highlighting) style to use.
138
149
pygments_style = 'sphinx'
168
179
# further. For a list of options available for each theme, see the
169
180
# documentation.
170
181
#
171
- # html_theme_options = {}
182
+ html_theme_options = {'navigation_depth' : 6 , 'titles_only' : True }
172
183
173
184
# Add any paths that contain custom static files (such as style sheets) here,
174
185
# relative to this directory. They are copied after the builtin static files,
235
246
# autodoc_member_order = 'bysource'
236
247
# autodoc_member_order = 'groupwise'
237
248
249
+ autosummary_generate = True
250
+ autosummary_ignore_module_all = True
251
+
238
252
# -- Check which conditional dependencies are available ------------------
239
253
# Used for skipping certain doctests
240
254
from sphinx .ext .doctest import doctest
@@ -267,20 +281,25 @@ def check_output(self, want, got, optionflags):
267
281
platform.python_implementation()
268
282
)
269
283
284
+ # We need multiprocessing because some doctests must be skipped if the
285
+ # start method is not "fork"
286
+ import multiprocessing
287
+
288
+ # (register plugins, make environ available to tests)
289
+ import pyomo.environ as pyo
290
+
270
291
from pyomo.common.dependencies import (
271
292
attempt_import, numpy_available, scipy_available, pandas_available,
272
293
yaml_available, networkx_available, matplotlib_available,
273
- pympler_available, dill_available,
294
+ pympler_available, dill_available, pint_available,
295
+ numpy as np,
274
296
)
275
- pint_available = attempt_import('pint', defer_import=False)[1]
276
297
from pyomo.contrib.parmest.parmest import parmest_available
277
298
278
- import pyomo.environ as _pe # (trigger all plugin registrations)
279
- import pyomo.opt as _opt
280
-
281
299
# Not using SolverFactory to check solver availability because
282
300
# as of June 2020 there is no way to suppress warnings when
283
301
# solvers are not available
302
+ import pyomo.opt as _opt
284
303
ipopt_available = bool(_opt.check_available_solvers('ipopt'))
285
304
sipopt_available = bool(_opt.check_available_solvers('ipopt_sens'))
286
305
k_aug_available = bool(_opt.check_available_solvers('k_aug'))
@@ -291,6 +310,11 @@ def check_output(self, want, got, optionflags):
291
310
292
311
baron = _opt.SolverFactory('baron')
293
312
313
+ if numpy_available:
314
+ # Recent changes on GHA seem to have dropped the default precision
315
+ # from 8 to 4; restore the default.
316
+ np.set_printoptions(precision=8)
317
+
294
318
if numpy_available and scipy_available:
295
319
import pyomo.contrib.pynumero.asl as _asl
296
320
asl_available = _asl.AmplInterface.available()
@@ -302,6 +326,11 @@ def check_output(self, want, got, optionflags):
302
326
ma27_available = False
303
327
mumps_available = False
304
328
329
+ # Mark that we are testing code (in this case, testing the documentation)
305
330
from pyomo.common.flags import in_testing_environment
306
331
in_testing_environment(True)
332
+
333
+ # Prevent any Pyomo logs from propagating up to the doctest logger
334
+ import logging
335
+ logging.getLogger('pyomo').propagate = False
307
336
'''
0 commit comments