Skip to content

Remove pyomo.duality and pyomo.core.plugins.transform.model#3876

Merged
blnicho merged 3 commits intoPyomo:mainfrom
jsiirola:remove-deprecated
Mar 20, 2026
Merged

Remove pyomo.duality and pyomo.core.plugins.transform.model#3876
blnicho merged 3 commits intoPyomo:mainfrom
jsiirola:remove-deprecated

Conversation

@jsiirola
Copy link
Member

@jsiirola jsiirola commented Mar 20, 2026

Fixes # .

Summary/Motivation:

This removes two {old, deprecated, poorly tested} pieces of Pyomo:

  • pyomo.duality - this package has been completely superseded by:
    • pyomo.duality.lagrangian_dual (deprecated since 5.6.2) is completely replaced by pyomo.core.plugins.transform.lp_dual
    • pyomo.duality.collect is replaced by pyomo.repn.plugins.standard_form. This is a more generalized and robust implementation (and with simpler, easier to use return data types)
      • Note we never officially deprecated this module. That said, it is buggy and not documented. To our knowledge, no one in the wild is using this module (otherwise they should have been complaining about the bugs). As it is not core functionality and does not appear in the Book, this PR proposes deleting the module without deprecation. An alternative path would be to create a small wrapper around the standard_form writer that re-creates the old return types (which will resolve the bugs) and then immediately deprecate that method. Providing the deprecation path would be several hours of work.
  • pyomo.core.plugins.transform.model (deprecated since 6.7.3) has been replaced by pyomo.repn.plugins.standard_form

Changes proposed in this PR:

  • remove pyomo.duality
  • remove pyomo.core.plugins.transform.model

Legal Acknowledgement

By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the BSD license.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

Comment on lines -91 to -96
self.run_bilevel(join(exdir, 't5.py'))
self.check('t5', 'linear_dual')

def test_t1(self):
self.problem = 'test_t1'
self.run_bilevel(join(exdir, 't1.py'))
Copy link
Member

Choose a reason for hiding this comment

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

There are a couple example py files used in these tests that are not deleted in this PR. I'm guessing they aren't being tested anywhere else so I wonder if they should be removed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch! Removed.

@codecov
Copy link

codecov bot commented Mar 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.92%. Comparing base (509f0d1) to head (3b001b6).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3876      +/-   ##
==========================================
+ Coverage   89.68%   89.92%   +0.24%     
==========================================
  Files         908      901       -7     
  Lines      106764   106285     -479     
==========================================
- Hits        95750    95581     -169     
+ Misses      11014    10704     -310     
Flag Coverage Δ
builders 29.19% <ø> (+0.11%) ⬆️
default 86.22% <ø> (?)
expensive 35.66% <ø> (?)
linux 87.38% <ø> (-1.80%) ⬇️
linux_other 87.38% <ø> (+0.23%) ⬆️
oldsolvers 28.11% <ø> (+0.11%) ⬆️
osx 82.70% <ø> (+0.21%) ⬆️
win 85.80% <ø> (+0.22%) ⬆️
win_other 85.80% <ø> (+0.22%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@blnicho blnicho merged commit 6744ca0 into Pyomo:main Mar 20, 2026
64 of 65 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants