Skip to content

Commit 67c9ef3

Browse files
committed
Merge branch 'main' into repn-refactor
2 parents 4e2d87a + 82906ae commit 67c9ef3

File tree

45 files changed

+1720
-579
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1720
-579
lines changed

.coin-or/projDesc.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ Carl D. Laird, Chair, Pyomo Management Committee, claird at andrew dot cmu dot e
157157
<!-- GLPK -->
158158
<!-- </packageName> -->
159159
<!-- <packageURL> -->
160-
<!-- http://www.gnu.org/software/glpk/ -->
161160
<!-- </packageURL> -->
162161
<!-- <requiredOrOptional> -->
163162
<!-- Optional -->

.github/workflows/test_branches.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,13 @@ jobs:
6464
verbose: true
6565
# How many times to retry a failed request (defaults to 1)
6666
retry_count: 3
67-
# Exclude Jenkins because it's behind a firewall; ignore RTD because
68-
# a magically-generated string is triggering a failure
67+
# Exclude:
68+
# - Jenkins because it's behind a firewall
69+
# - RTD because a magically-generated string triggers failures
6970
exclude_urls: https://pyomo-jenkins.sandia.gov/,https://pyomo.readthedocs.io/en/%s/errors.html
71+
# Exclude:
72+
# - All gnu.org links because they consistently fail the checker
73+
exclude_patterns: https://www.gnu.org
7074

7175

7276
build:

.github/workflows/test_pr_and_main.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,13 @@ jobs:
7575
verbose: true
7676
# How many times to retry a failed request (defaults to 1)
7777
retry_count: 3
78-
# Exclude Jenkins because it's behind a firewall; ignore RTD because
79-
# a magically-generated string is triggering a failure
78+
# Exclude:
79+
# - Jenkins because it's behind a firewall
80+
# - RTD because a magically-generated string triggers failures
8081
exclude_urls: https://pyomo-jenkins.sandia.gov/,https://pyomo.readthedocs.io/en/%s/errors.html
82+
# Exclude:
83+
# - All gnu.org links because they consistently fail the checker
84+
exclude_patterns: https://www.gnu.org
8185

8286

8387
build:

.github/workflows/url_check.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,6 @@ jobs:
3030
# - Jenkins because it's behind a firewall
3131
# - RTD because a magically-generated string triggers failures
3232
exclude_urls: https://pyomo-jenkins.sandia.gov/,https://pyomo.readthedocs.io/en/%s/errors.html
33+
# Exclude:
34+
# - All gnu.org links because they consistently fail the checker
35+
exclude_patterns: https://www.gnu.org

doc/OnlineDocs/_templates/recursive-base.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515

1616
.. currentmodule:: {{ module }}
1717

18-
.. auto{{ objtype }}:: {{ objname }}
18+
.. auto{{ objtype }}:: {{ module }}::{{ objname }}

doc/OnlineDocs/conf.py

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,94 @@
162162
# they have a caption.
163163
numfig = True
164164

165+
166+
# We want to be able to document the CONFIG class attribute in a special
167+
# section. Nominally, we would use the napoleon_custom_sections hook.
168+
# Unfortunately, there isn't a generic "kwargs_style", and aliasing
169+
# 'Keyword Arguments' would render the section header in the
170+
# documentation as 'Keyword Arguments'.
171+
#
172+
# Our solution is to declare a new PyObject field type (:config:) and
173+
# define a new parser that generates :config: fields. We register the
174+
# new parser with Napoleon by monkey-patching _load_custom_sections().
175+
def _monkey_patch_napoleon():
176+
from sphinx.ext.napoleon.docstring import GoogleDocstring
177+
from sphinx.domains.python._object import PyObject, PyTypedField
178+
from sphinx.locale import _
179+
from sphinx import addnodes
180+
from functools import partial
181+
182+
class PyConfigDomainField(PyTypedField):
183+
def make_xref(
184+
self,
185+
rolename: str,
186+
domain: str,
187+
target: str,
188+
innernode=addnodes.literal_emphasis,
189+
contnode=None,
190+
env=None,
191+
inliner=None,
192+
location=None,
193+
):
194+
ans = super().make_xref(
195+
rolename=rolename,
196+
domain=domain,
197+
target=target,
198+
innernode=innernode,
199+
contnode=contnode,
200+
env=env,
201+
inliner=inliner,
202+
location=location,
203+
)
204+
# Part of the call stack will override the reftype to
205+
# "class". We want to support a broader set of domain
206+
# types, so we will set it to "anything" (i.e., object)
207+
ans['reftype'] = 'obj'
208+
return ans
209+
210+
PyObject.doc_field_types.append(
211+
PyConfigDomainField(
212+
'config',
213+
label=_('CONFIG'),
214+
names=('config',),
215+
typerolename='obj',
216+
typenames=('configtype',),
217+
can_collapse=True,
218+
)
219+
)
220+
PyObject.doc_field_types.append(
221+
PyConfigDomainField(
222+
'option',
223+
label=_('Options'),
224+
names=('option',),
225+
typerolename='obj',
226+
typenames=('optiontype',),
227+
can_collapse=True,
228+
)
229+
)
230+
231+
def _parse_config_section(self, field: str, section: str) -> list[str]:
232+
fields = self._consume_fields()
233+
if self._config.napoleon_use_keyword:
234+
return self._format_docutils_params(
235+
fields, field_role=field, type_role=field + 'type'
236+
)
237+
else:
238+
return self._format_fields(_(section), fields)
239+
240+
original_loader = GoogleDocstring._load_custom_sections
241+
242+
def _load_custom_sections(self):
243+
self._sections['config'] = partial(self._parse_config_section, 'config')
244+
self._sections['options'] = partial(self._parse_config_section, 'option')
245+
return original_loader(self)
246+
247+
GoogleDocstring._parse_config_section = _parse_config_section
248+
GoogleDocstring._load_custom_sections = _load_custom_sections
249+
250+
251+
_monkey_patch_napoleon()
252+
165253
# -- Options for HTML output ----------------------------------------------
166254

167255
# The theme to use for HTML and HTML Help pages. See the documentation for

doc/OnlineDocs/explanation/analysis/parmest/driver.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ List of experiment objects
9898
--------------------------
9999

100100
The first argument is a list of experiment objects which is used to
101-
create one labeled model for each expeirment.
101+
create one labeled model for each experiment.
102102
The template :class:`~pyomo.contrib.parmest.experiment.Experiment`
103103
can be used to generate a list of experiment objects.
104104

0 commit comments

Comments
 (0)