-
Notifications
You must be signed in to change notification settings - Fork 559
Introduce formal principle documentation to support contrib changes #3768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
74aee3f
ca02f4e
8e18ee1
4822e6d
9e4b67c
5f37e4a
1be9b29
5d7f102
ed7f9dd
6999a91
cff39eb
1b023a8
ce089c4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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 on lines
+81
to
+83
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not technically true (the availability / plugin / filtering from
Suggested change
|
||||||||||||||||
| 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")`` | ||||||||||||||||
mrmundt marked this conversation as resolved.
Show resolved
Hide 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. | ||||||||||||||||
|
|
@@ -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] | ||||||||||||||||
mrmundt marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||
|
|
||||||||||||||||
| These commands register the cloned code with the active python environment | ||||||||||||||||
| (``pyomodev``). This way, your changes to the source code for ``pyomo`` are | ||||||||||||||||
|
|
||||||||||||||||
| 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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No comma after principles, I think. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 on lines
+19
to
+20
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| new edition of the book. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+20
to
+21
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While this is what we currently do, it is a strong statement/commitment. I'm fine with this, but I wanted to flag it for discussion.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I might be for hedging and just saying next major Pyomo release and failing to mention the promise of books?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We talked about this in the dev call today (loosely). This is our "current" approach but nothing says we can't change it in the future, especially after the next book.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can always hedge our promise with something like |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| This commitment ensures that teaching materials, training resources, and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| long-term codebases built on those examples will remain valid across an | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 on lines
+45
to
+46
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should add something about the expected lifetime of a deprecation path for core (but not Book) functionality. Possibilities include:
I think I would advocate 2 minor releases: that is, if you deprecate something in
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I really like this idea!! 2 minor releases seems right. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .. 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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| +++++++++++++++++++++++++++++++++ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Historically, all contributed and experimental functionality has lived | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| under ``pyomo.contrib``. These packages are community-driven extensions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * ``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 on lines
+85
to
+93
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Optional Dependencies | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| +++++++++++++++++++++ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+95
to
+96
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Pyomo supports a number of optional dependencies that enhance its | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| functionality. These are grouped into three categories: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+98
to
+99
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * **Tests** – Dependencies needed only to run the automated test suite | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| and continuous integration infrastructure (e.g., ``pytest``, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ``parameterized``, ``coverage``). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * **Docs** – Dependencies needed to build the Sphinx-based documentation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (e.g., ``sphinx``, ``sphinx_rtd_theme``, ``numpydoc``). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * **Optional** – Dependencies that enable extended | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| functionality throughout the Pyomo codebase, such as numerical | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| computations or data handling (e.g., ``numpy``, ``pandas``, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ``matplotlib``). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+108
to
+111
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have developer docs for how to handle importing optional dependencies? I feel like the answer is probably 'no', but we should add that to the (endless) documentation todo list, and link that here... |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mrmundt marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| :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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mrmundt marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. refer -> "refer to it" |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * **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 on lines
+152
to
+153
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. avoid import * is listed twice.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's how much Miranda cares!! :P |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * **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 on lines
+158
to
+159
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * **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 on lines
+166
to
+169
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @blnicho, didn't you have more specific guidance for this at one point too? Character limit and starting with "package:" or something like that that we fail to do most of the time? |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * **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``. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * **File headers:** Every ``.py`` file must begin with the standard Pyomo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| copyright header: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .. code-block:: text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this be |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # ___________________________________________________________________________ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # 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. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A few more in-the-weeds ideas we could add to this list (or defer for a more in-the-weeds thing later--I'm not super attached to any of these, just brainstorming):
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Edit to the third bullet based on dev call discussion: If you want to gather all the variables on the model, it is recommended to use
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I strongly agree with all of these.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Me too. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,7 @@ Reference Guides | |
| .. toctree:: | ||
| :maxdepth: 1 | ||
|
|
||
| ../principles | ||
| future | ||
| ../errors | ||
| ../related_packages | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # Pyomo Addons | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is duplicative of the material in the online docs. Under the principle that we shouldn't repeat ourselves / have one source of truth, I would recommend either removing this README, or reducing it to a link to the online docs. |
||
|
|
||
| The `pyomo.addons` directory contains **mostly stable extensions** to Pyomo | ||
| that are **not part of the core library*. These packages extend Pyomo's | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this missing an *? |
||
| 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 on lines
+14
to
+15
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this bullet adds any value, and I think it could be misconstrued. |
||
|
|
||
| Examples include: | ||
| - `gdpopt` | ||
| - `incidence_analysis` | ||
| - `latex_printer` | ||
| - `trustregion` | ||
| - `viewer` | ||
|
Comment on lines
+17
to
+22
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can't people just look to see what is in the addons directory? Why list it here?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have an answer to this one! Because as of this PR, there will be nothing in the |
||
|
|
||
| ## 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. | ||
mrmundt marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### 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: | ||
mrmundt marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - Functionality | ||
| - Example usage or link to docs | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think "or link to docs" answers one of my earlier questions. |
||
|
|
||
| ### 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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this section a duplicate of "Stability and Maintenance" above? |
||
| - 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. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # Pyomo Devel | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is duplicative of the material in the online docs. Under the principle that we shouldn't repeat ourselves / have one source of truth, I would recommend either removing this README, or reducing it to a link to the online docs. |
||
|
|
||
| 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 on lines
+18
to
+22
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, I don't think this list is needed. |
||
|
|
||
| ## 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. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is auto-generated stuff?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup - when you run
make -C doc/OnlineDocs html, this is all the automatic api docs that get generated. Which are great, we love them, but I have almost accidentally committed them way too many times.