Skip to content

Commit e3ad661

Browse files
authored
Merge branch 'main' into linear-dual-fix
2 parents f5a38c5 + fa799a9 commit e3ad661

File tree

104 files changed

+5764
-1726
lines changed

Some content is hidden

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

104 files changed

+5764
-1726
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: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ jobs:
4444
python-version: '3.10'
4545
- name: Black Formatting Check
4646
run: |
47-
# Note v24.4.1 fails due to a bug in the parser
47+
# Note v24.4.1 fails due to a bug in the parser. Project-level
48+
# configuration is inherited from pyproject.toml.
4849
pip install 'black!=24.4.1'
49-
black . -S -C --check --diff --exclude examples/pyomobook/python-ch/BadIndent.py
50+
black . --check --diff
5051
- name: Spell Check
5152
uses: crate-ci/typos@master
5253
with:
@@ -63,9 +64,13 @@ jobs:
6364
verbose: true
6465
# How many times to retry a failed request (defaults to 1)
6566
retry_count: 3
66-
# Exclude Jenkins because it's behind a firewall; ignore RTD because
67-
# 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
6870
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
6974

7075

7176
build:

.github/workflows/test_pr_and_main.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ jobs:
5555
python-version: '3.10'
5656
- name: Black Formatting Check
5757
run: |
58-
# Note v24.4.1 fails due to a bug in the parser
58+
# Note v24.4.1 fails due to a bug in the parser. Project-level
59+
# configuration is inherited from pyproject.toml.
5960
pip install 'black!=24.4.1'
60-
black . -S -C --check --diff --exclude examples/pyomobook/python-ch/BadIndent.py
61+
black . --check --diff
6162
- name: Spell Check
6263
uses: crate-ci/typos@master
6364
with:
@@ -74,9 +75,13 @@ jobs:
7475
verbose: true
7576
# How many times to retry a failed request (defaults to 1)
7677
retry_count: 3
77-
# Exclude Jenkins because it's behind a firewall; ignore RTD because
78-
# 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
7981
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
8085

8186

8287
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/contribution_guide.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,17 @@ run:
3737

3838
# Auto-apply correct formatting
3939
pip install black
40-
black -S -C <path> --exclude examples/pyomobook/python-ch/BadIndent.py
40+
black <path>
4141
# Find typos in files
4242
conda install typos
4343
typos --config .github/workflows/typos.toml <path>
4444
45-
If the spell-checker returns a failure for a word that is spelled correctly,
46-
please add the word to the ``.github/workflows/typos.toml`` file.
45+
If the spell-checker returns a failure for a word that is spelled
46+
correctly, please add the word to the ``.github/workflows/typos.toml``
47+
file. Note also that ``black`` reads from ``pyproject.toml`` to
48+
determine correct configuration, so if you are running ``black``
49+
indirectly (for example, using an IDE integration), please ensure you
50+
are not overriding the project-level configuration set in that file.
4751

4852
Online Pyomo documentation is generated using `Sphinx <https://www.sphinx-doc.org/en/master/>`_
4953
with the ``napoleon`` extension enabled. For API documentation we use of one of these
@@ -332,7 +336,7 @@ Finally, move to the directory containing the clone of your Pyomo fork and run:
332336

333337
::
334338

335-
python setup.py develop
339+
pip install -e .
336340

337341
These commands register the cloned code with the active python environment
338342
(``pyomodev``). This way, your changes to the source code for ``pyomo`` are

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

doc/OnlineDocs/explanation/contrib_index.txt

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)