-
Notifications
You must be signed in to change notification settings - Fork 582
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
Changes from 2 commits
74aee3f
ca02f4e
8e18ee1
4822e6d
9e4b67c
5f37e4a
1be9b29
5d7f102
ed7f9dd
6999a91
cff39eb
1b023a8
ce089c4
af64211
9c03e5a
f12f1f7
31698dc
8feac13
92b607c
9306204
64b25da
7bdffc1
854c0c0
88f7cae
7eccf54
a0c3d47
46e9c7b
dc97bbc
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 |
|---|---|---|
| @@ -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 | ||
|
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 | ||
|
mrmundt marked this conversation as resolved.
Outdated
|
||
| new edition of the book. | ||
|
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 | ||
|
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. | ||
|
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 | ||
|
mrmundt marked this conversation as resolved.
Outdated
|
||
| +++++++++++++++++++++++++++++++++ | ||
|
|
||
| Historically, all contributed and experimental functionality has lived | ||
| under ``pyomo.contrib``. These packages are community-driven extensions | ||
|
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. | ||
|
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. | ||
|
mrmundt marked this conversation as resolved.
Outdated
|
||
|
|
||
|
mrmundt marked this conversation as resolved.
|
||
| Optional Dependencies | ||
| +++++++++++++++++++++ | ||
|
mrmundt marked this conversation as resolved.
|
||
|
|
||
| Pyomo supports a number of optional dependencies that enhance its | ||
| functionality. These are grouped into three categories: | ||
|
mrmundt marked this conversation as resolved.
Outdated
|
||
|
|
||
| * **Tests** – Dependencies needed only to run the automated test suite | ||
|
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 | ||
|
mrmundt marked this conversation as resolved.
Outdated
|
||
| (e.g., ``sphinx``, ``sphinx_rtd_theme``, ``numpydoc``). | ||
|
|
||
| * **Optional** – Dependencies that enable extended | ||
|
mrmundt marked this conversation as resolved.
Outdated
|
||
| functionality throughout the Pyomo codebase, such as numerical | ||
| computations or data handling (e.g., ``numpy``, ``pandas``, | ||
| ``matplotlib``). | ||
|
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 | ||
|
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 | ||
|
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: | ||
|
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 *``. | ||
|
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. | ||
|
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. | ||
|
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``. | ||
|
mrmundt marked this conversation as resolved.
Outdated
|
||
|
|
||
| * **File headers:** Every ``.py`` file must begin with the standard Pyomo | ||
| copyright header: | ||
|
|
||
| .. code-block:: text | ||
|
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. | ||
|
mrmundt marked this conversation as resolved.
|
||
| 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 | ||||||
|
mrmundt marked this conversation as resolved.
|
||||||
|
|
||||||
| The `pyomo.addons` directory contains **mostly stable extensions** to Pyomo | ||||||
|
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
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 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 | ||||||
|
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. | ||||||
|
mrmundt marked this conversation as resolved.
Outdated
|
||||||
|
|
||||||
| Examples include: | ||||||
| - `gdpopt` | ||||||
| - `incidence_analysis` | ||||||
| - `latex_printer` | ||||||
| - `trustregion` | ||||||
| - `viewer` | ||||||
|
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. | ||||||
|
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: | ||||||
|
mrmundt marked this conversation as resolved.
Outdated
|
||||||
| - Functionality | ||||||
| - Example usage or link to docs | ||||||
|
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 | ||||||
|
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. | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # Pyomo Devel | ||
|
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` | ||
|
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. | ||
Uh oh!
There was an error while loading. Please reload this page.