Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
74aee3f
Introduce formal principle documentation to support contrib changes
mrmundt Oct 21, 2025
ca02f4e
Found a weird phrasing that I missed when proofreading
mrmundt Oct 21, 2025
8e18ee1
Whoops, no init files
mrmundt Oct 22, 2025
4822e6d
Move redundant information and do a big rework of contribution guide
mrmundt Oct 22, 2025
9e4b67c
Typo
mrmundt Oct 22, 2025
5f37e4a
Merge branch 'main' into addons-devel
blnicho Oct 27, 2025
1be9b29
Wrong word in contribution guide
mrmundt Oct 27, 2025
5d7f102
Minor corrections in installation docs
blnicho Oct 27, 2025
ed7f9dd
Address blnicho's comments
mrmundt Oct 28, 2025
6999a91
Merge branch 'main' into addons-devel
mrmundt Oct 28, 2025
cff39eb
Add convention about printing to stdout
mrmundt Oct 28, 2025
1b023a8
Merge branch 'main' into addons-devel
blnicho Oct 29, 2025
ce089c4
Merge branch 'main' into addons-devel
mrmundt Nov 4, 2025
af64211
Merge branch 'main' into addons-devel
mrmundt Jan 21, 2026
9c03e5a
Merge branch 'main' into addons-devel
mrmundt Jan 21, 2026
f12f1f7
Save state: Partially addressed comments
mrmundt Jan 21, 2026
31698dc
Merge branch 'main' into addons-devel
mrmundt Jan 23, 2026
8feac13
Update READMEs to have them point to official guidelines
mrmundt Jan 23, 2026
92b607c
Missing end-bold-note
mrmundt Jan 23, 2026
9306204
Merge branch 'main' of github.com:pyomo/pyomo into addons-devel
mrmundt Jan 26, 2026
64b25da
Add all the extra suggested principles
mrmundt Jan 26, 2026
7bdffc1
Missed one principle about logging
mrmundt Jan 26, 2026
854c0c0
Get rid of examples package, put it in docs instead
mrmundt Jan 26, 2026
88f7cae
Remove example from environ
mrmundt Jan 27, 2026
7eccf54
Merge branch 'main' of github.com:pyomo/pyomo into addons-devel
mrmundt Feb 4, 2026
a0c3d47
Apply @jsiirola requested changes
mrmundt Feb 4, 2026
46e9c7b
Address @blnicho 's comments
mrmundt Feb 9, 2026
dc97bbc
Missed colon
mrmundt Feb 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ __pycache__/
*.egg-info/

# Documentation builds
doc/OnlineDocs/api
Comment thread
mrmundt marked this conversation as resolved.
doc/OnlineDocs/_build
doc/OnlineDocs/**/*.spy

Expand Down
28 changes: 27 additions & 1 deletion doc/OnlineDocs/contribution_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,32 @@ at least 70% coverage of the lines modified in the PR and prefer coverage
closer to 90%. We also require that all tests pass before a PR will be
merged.

Tests must import the Pyomo test harness from
``pyomo.common.unittest`` instead of using Python's built-in
``unittest`` module directly. This wrapper extends the standard testing
framework with Pyomo-specific capabilities, including automatic plugin
discovery, solver availability checks, and improved test filtering
controls. Using the provided interface ensures that all tests run
Comment thread
mrmundt marked this conversation as resolved.
Outdated
consistently across Pyomo's multiple CI environments.
A small example is shown below:

.. code-block:: python

import pyomo.common.unittest as unittest

class TestSomething(unittest.TestCase):
def test_basic(self):
self.assertEqual(1 + 1, 2)

Developers can also use any of the predefined ``pytest`` markers to categorize
their tests appropriately.
Markers are declared in ``pyproject.toml``. Some commonly used markers are:

- ``expensive``: tests that take a long time to run
- ``mpi``: tests that require MPI
- ``solver(name)``: dynamic marker to label a test for a specific solver,
e.g., ``@pytest.mark.solver("gurobi")``
Comment thread
mrmundt marked this conversation as resolved.

.. note::
If you are having issues getting tests to pass on your Pull Request,
please tag any of the core developers to ask for help.
Expand Down Expand Up @@ -336,7 +362,7 @@ Finally, move to the directory containing the clone of your Pyomo fork and run:

::

pip install -e .
pip install -e .[tests,docs,optional]
Comment thread
mrmundt marked this conversation as resolved.

These commands register the cloned code with the active python environment
Comment thread
mrmundt marked this conversation as resolved.
Outdated
(``pyomodev``). This way, your changes to the source code for ``pyomo`` are
Expand Down
218 changes: 218 additions & 0 deletions doc/OnlineDocs/principles.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
Development Principles
======================

The Pyomo development team follows a set of development principles.
In order to promote overall transparency, this page is intended to document
those principles, to the best of our ability, for users and potential
Comment thread
mrmundt marked this conversation as resolved.
Outdated
contributors alike. Please also review Pyomo's recent publication
on the history of its development for a holistic view into the changes
of these principles over time [MHJ+25]_.

Backwards Compatibility
-----------------------

Commitment to Published Interfaces
++++++++++++++++++++++++++++++++++

If functionality is published in the most recent edition of the
Pyomo book [PyomoBookIII]_ and corresponding examples, we treat that as
a public API commitment. Once published in the book, those APIs will not
change until the next major Pyomo release, which will coincide with a
Comment thread
mrmundt marked this conversation as resolved.
Outdated
new edition of the book.
Comment thread
mrmundt marked this conversation as resolved.
Outdated

This commitment ensures that teaching materials, training resources, and
long-term codebases built on those examples will remain valid across an
Comment thread
mrmundt marked this conversation as resolved.
Outdated
entire major release.

Stable, Supported APIs
++++++++++++++++++++++

Functionality that is part of the Pyomo source tree but not explicitly
included in the book is also expected to be stable if it resides outside
the ``contrib`` (or future ``addons`` / ``devel``) directories.

When changes to these APIs become necessary, we will endeavor to follow one
(or both) of the following steps:

1. **Deprecation warnings** are added in advance of functionality removal.
These are visible to users at import or execution time,
with clear guidance on replacement functionality.
2. **Relocation warnings** are provided for any relocated functionality.
These modules import from their old locations and print a warning about
the relocation in order to assist users' transition.

Ideally, changes in this fashion can allow users and downstream packages
to adapt gradually without abrupt breakage.
Comment thread
mrmundt marked this conversation as resolved.
Outdated

.. note::

For detailed guidance on how to mark functionality for deprecation or
removal within the Pyomo codebase, see
:doc:`/explanation/developer_utils/deprecation`.

Experimental and Contributed Code
Comment thread
mrmundt marked this conversation as resolved.
Outdated
+++++++++++++++++++++++++++++++++

Historically, all contributed and experimental functionality has lived
under ``pyomo.contrib``. These packages are community-driven extensions
Comment thread
mrmundt marked this conversation as resolved.
Outdated
that may evolve rapidly as research and experimentation continue. Users
should not rely on API stability within this space.

Pyomo is currently transitioning to a clearer organizational model that
distinguishes between two categories:

* ``pyomo.addons`` – Mostly stable, supported extensions maintained by
specific contributors.
Comment thread
mrmundt marked this conversation as resolved.
Outdated

* ``pyomo.devel`` – Active research and experimental code.

The guiding philosophy is to protect users from surprises in stable
interfaces while continuing to enable innovation and experimentation
in development areas.

Dependency Management
---------------------

Minimal Core Dependencies
+++++++++++++++++++++++++

Pyomo core is intentionally designed to have only one required
dependency: ``ply``. This ensures that the base functionality of Pyomo
can operate using only standard Python libraries and ``ply``.

This approach promotes overall ease of installation, allowing other packages
to depend and be built upon Pyomo.
Additionally, this allows users to install and run Pyomo in
resource-constrained or isolated environments (such as teaching
containers or HPC systems). All additional packages are optional.
Comment thread
mrmundt marked this conversation as resolved.
Outdated

Comment thread
mrmundt marked this conversation as resolved.
Optional Dependencies
+++++++++++++++++++++
Comment thread
mrmundt marked this conversation as resolved.

Pyomo supports a number of optional dependencies that enhance its
functionality. These are grouped into three categories:
Comment thread
mrmundt marked this conversation as resolved.
Outdated

* **Tests** – Dependencies needed only to run the automated test suite
Comment thread
mrmundt marked this conversation as resolved.
Outdated
and continuous integration infrastructure (e.g., ``pytest``,
``parameterized``, ``coverage``).

* **Docs** – Dependencies needed to build the Sphinx-based documentation
Comment thread
mrmundt marked this conversation as resolved.
Outdated
(e.g., ``sphinx``, ``sphinx_rtd_theme``, ``numpydoc``).

* **Optional** – Dependencies that enable extended
Comment thread
mrmundt marked this conversation as resolved.
Outdated
functionality throughout the Pyomo codebase, such as numerical
computations or data handling (e.g., ``numpy``, ``pandas``,
``matplotlib``).
Comment thread
mrmundt marked this conversation as resolved.
Outdated

These optional dependencies can be installed selectively using standard
``pip`` commands. For example:

::

pip install pyomo[optional]
pip install pyomo[tests,docs]

Pyomo's continuous integration infrastructure regularly tests against
the most recent versions of all optional dependencies to ensure that
Pyomo remains compatible with current releases in the Python ecosystem.
When incompatibilities are identified, the setup configuration is
updated accordingly.

.. note::

For more information on installing Pyomo with optional extras,
see :doc:`/getting_started/installation`.

Solvers
+++++++

Pyomo does not bundle or directly distribute optimization solvers.
We recognize that solver installation can be challenging for new users.
To assist with this process, the documentation includes a solver
availability table and installation guidance in
Comment thread
mrmundt marked this conversation as resolved.
Outdated
:doc:`/getting_started/solvers`. This table lists solvers that can be
installed via ``pip`` or ``conda`` where available, but Pyomo itself
does not include or require any specific solver as a dependency.


Contributed Packages
Comment thread
mrmundt marked this conversation as resolved.
Outdated
--------------------

Pyomo has a long history of supporting community-developed extensions.
Historically, all such contributions were placed under the
``pyomo.contrib`` namespace. This structure allowed new modeling tools
and algorithms to be shared quickly, but over time it has become difficult
for users to distinguish between more stable, supported functionality and
experimental or research-oriented code.

As a result, Pyomo is transitioning to a more structured contribution
model with two clear namespaces:

* ``pyomo.addons`` – For mostly stable, supported extensions that build on
the Pyomo core. These packages are maintained by dedicated
contributors, follow Pyomo's coding and testing standards, and adhere
to the same deprecation policies as the rest of the codebase.

* ``pyomo.devel`` – For experimental or rapidly evolving
contributions. These modules serve as early experimentation for research ideas,
prototypes, or specialized modeling components. Functionality under
this namespace may change or be removed between releases without
deprecation warnings.

The long-term goal is to provide users and contributors with clearer
expectations of code maturity and stability. Users can rely on
``addons`` as stable extensions to Pyomo's core capabilities, while
``devel`` packages remain a flexible space for experimentation.

.. note::

For procedural guidance on how to structure and submit new
contributions to Pyomo, please visit :doc:`contribution_guide`.


Miscellaneous Conventions
-------------------------

There are a variety of long-standing conventions that have become
standard across the project. This list will be amended as conventions come
up, so please refer regularly for updates:
Comment thread
mrmundt marked this conversation as resolved.
Outdated

* **Environment imports:** Import the main Pyomo environment as
``import pyomo.environ as pyo``.
Avoid ``from pyomo.environ import *`` or alternative aliases.
Additionally, avoid all uses of ``import *``.
Comment thread
mrmundt marked this conversation as resolved.
Outdated

* **Export lists:** Do not define ``__all__`` in modules.
Public symbols are determined by naming and documentation, not explicit lists.

* **Circular imports:** Avoid importing from ``pyomo.core`` into any module
in ``pyomo.common`` due to the potential for circular imports.
Comment thread
mrmundt marked this conversation as resolved.
Outdated

* **Pull Request naming:** Pull Request titles are added to the CHANGELOG
and the release notes. The Pyomo development team reserves the right to
alter titles as appropriate to ensure they fit the look and feel of
other titles in the CHANGELOG.
Comment thread
mrmundt marked this conversation as resolved.
Outdated

* **Full commit history:** We do **not** squash-merge Pull Requests,
preferring to retain the entire commit history.

* **URLs:** All links in code, comments, and documentation must use ``https``
rather than ``http``.
Comment thread
mrmundt marked this conversation as resolved.
Outdated

* **File headers:** Every ``.py`` file must begin with the standard Pyomo
copyright header:

.. code-block:: text
Comment thread
mrmundt marked this conversation as resolved.
Outdated

# ___________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2008-2025
# National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and
# Engineering Solutions of Sandia, LLC, the U.S. Government retains certain
# rights in this software.
# This software is distributed under the 3-clause BSD License.
# ___________________________________________________________________________

Update the year range as appropriate when modifying files.
Comment thread
mrmundt marked this conversation as resolved.
6 changes: 6 additions & 0 deletions doc/OnlineDocs/reference/bibliography.rst
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ Bibliography
Intermediate Relaxations between big-M and Convex Hull
Reformulations". 2021. https://arxiv.org/abs/2101.12708

.. [MHJ+25] M. Mundt, W. E. Hart, E. S. Johnson, B. Nicholson, and
J. D. Siirola. "Pyomo: Accidentally outrunning the bear", *Patterns*,
6(7), 101311. 2025. ISSN 2666-3899. DOI
`10.1016/j.patter.2025.101311
<https://doi.org/10.1016/j.patter.2025.101311>`_

.. [NW88] G. L. Nemhauser and L. A. Wolsey. *Integer and combinatorial
optimization*, New York: Wiley. 1988.

Expand Down
1 change: 1 addition & 0 deletions doc/OnlineDocs/reference/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Reference Guides
.. toctree::
:maxdepth: 1

../principles
future
../errors
../related_packages
Expand Down
58 changes: 58 additions & 0 deletions pyomo/addons/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Pyomo Addons
Comment thread
mrmundt marked this conversation as resolved.

The `pyomo.addons` directory contains **mostly stable extensions** to Pyomo

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The `pyomo.addons` directory contains **mostly stable extensions** to Pyomo
The `pyomo.addons` directory contains **stable extensions** to Pyomo

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree. We explicitly say "mostly stable" everywhere else we talk about addons. This was intentional language to follow the idea of "some level of promised stability," but they still might change in small ways.

that are **not part of the core library*. These packages extend Pyomo's
Comment thread
mrmundt marked this conversation as resolved.
Outdated
modeling, solver, and analysis capabilities, and have demonstrated sufficient
maturity, documentation, and testing.

## Purpose

`pyomo.addons` houses packages that:

- Have **mostly stable APIs** suitable for downstream use.
- Are **sufficiently documented** and **tested**.
- Represent functionality that is **useful to the wider Pyomo community** but
not required for core operation.
Comment thread
mrmundt marked this conversation as resolved.
Outdated

Examples include:
- `gdpopt`
- `incidence_analysis`
- `latex_printer`
- `trustregion`
- `viewer`
Comment thread
mrmundt marked this conversation as resolved.
Outdated

## Requirements

A package may be accepted into `pyomo.addons` once it meets all of the
following criteria.

### Stability and Maintenance
- The code must be **mostly stable** with minimal expected API changes.
- There must be at least one **designated maintainer** responsible for upkeep,
compatibility, and user support.
- The package must not rely on deprecated or experimental Pyomo internals.
Comment thread
mrmundt marked this conversation as resolved.
Outdated

### Testing
- Test coverage should be **at least 80%**, or comparable to similar supported modules.
- Tests must run successfully within the Pyomo CI environment.
- Expensive, solver-specific, or optional tests should be properly marked
(e.g., with `@pytest.mark.expensive`, `@pytest.mark.solver`).

### Documentation
- Each addon must include:
- (PREFERABLE) A **reference page** in the Pyomo online documentation.
- (MINIMUM) A **README.md** file in the addon directory summarizing:
Comment thread
mrmundt marked this conversation as resolved.
Outdated
- Functionality
- Example usage or link to docs
Comment thread
mrmundt marked this conversation as resolved.
Outdated

### Dependencies
- Addons **may not introduce required dependencies** for Pyomo core.
- Optional dependencies must be:
- Declared in `setup.py` under the appropriate category.
- Publicly available on PyPI and/or Anaconda and reasonably maintained.

### Backward Compatibility
Comment thread
mrmundt marked this conversation as resolved.
Outdated
- Addons are expected to maintain **backward-compatible APIs** between minor
Pyomo releases.
- Breaking changes must follow the documented **deprecation process** and
appear in release notes.
48 changes: 48 additions & 0 deletions pyomo/devel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Pyomo Devel
Comment thread
mrmundt marked this conversation as resolved.

The `pyomo.devel` directory contains **experimental, research-oriented, or
rapidly evolving** extensions to Pyomo. These packages are **not guaranteed to
be stable** and may change or be removed between releases **without
deprecation warnings**.

## Purpose

`pyomo.devel` is intended for:

- Experimental algorithms and modeling approaches.
- Research prototypes under active development.
- Functionality that is **not yet ready for long-term API guarantees**.
- Work that may later graduate into `pyomo.addons` after sufficient
maturity, including testing and documentation.

Examples include:
- `doe`
- `piecewise`
- `solver`
- `sensitivity_toolbox`
Comment thread
mrmundt marked this conversation as resolved.
Outdated

## Expectations

Packages placed in `pyomo.devel` are **encouraged to be exploratory** but must
still meet basic project standards to ensure they do not break the broader
Pyomo ecosystem.

### Stability
- APIs in this directory are **not stable** and **may change or be removed**
without notice.
- Users should not rely on `pyomo.devel` components for production workflows.

### Testing
- All `devel` packages must include **basic tests** verifying import and
execution of key components.
- Tests should run under Pyomo's CI but may be skipped in qualifying scenarios.

### Documentation
- At minimum, each package should contain:
- A **README.md** describing the purpose and experimental status.

### Dependencies
- Packages in `devel` **may not introduce required dependencies** for Pyomo core.
- Optional dependencies must be:
- Declared in `setup.py` under the appropriate category.
- Publicly available on PyPI and/or Anaconda and reasonably maintained.
Loading