Skip to content

Improved support for moved/renamed/deprecated modules#3385

Merged
blnicho merged 22 commits intoPyomo:mainfrom
jsiirola:moved-modules
Nov 5, 2024
Merged

Improved support for moved/renamed/deprecated modules#3385
blnicho merged 22 commits intoPyomo:mainfrom
jsiirola:moved-modules

Conversation

@jsiirola
Copy link
Copy Markdown
Member

Fixes # .

Summary/Motivation:

NOTE: This PR is built on #3382. Please review / merge that PR before looking at this one. If you want to get a head start, you can compare this branch against the doc-reorg branch.

This PR replaces pyomo.common.deprecation.relocated_module() with pyomo.common.deprecation.moved_module(). The new functionality supports renamed / moved / deprecated modules through a plugin to the importlib system (instead of hacking sys.modules). This:

  • is more robust
  • allows us to remove stub files that have been accumulating in the codebase
  • silence all deprecation warnings that are currently being emitted when building the documentation
  • removes the deprecated modules from the online documentation Library Reference
  • supports deprecation paths for more complex module reorganizations (e.g., converting all plugins directories into plugins.py modules)

Changes proposed in this PR:

  • deprecate pyomo.common.deprecation.relocated_module()
  • add pyomo.common.deprecation.moved_module().
  • remove deprecated "stub" modules
  • move deprecated modules that import specific functionality into the pyomo._archive directory
  • rename pyomo/__future__.py -> pyomo.future.py
    • continue to support from pyomo.__future__ import ...
    • this resolves exceptions when attempting to run python within the pyomo/pyomo directory.

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.

@codecov
Copy link
Copy Markdown

codecov bot commented Oct 31, 2024

Codecov Report

Attention: Patch coverage is 98.97959% with 1 line in your changes missing coverage. Please review.

Project coverage is 88.58%. Comparing base (ad90ee2) to head (c37dda3).
Report is 615 commits behind head on main.

Files with missing lines Patch % Lines
pyomo/common/deprecation.py 97.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3385      +/-   ##
==========================================
+ Coverage   88.57%   88.58%   +0.01%     
==========================================
  Files         883      879       -4     
  Lines      100343   100371      +28     
==========================================
+ Hits        88882    88918      +36     
+ Misses      11461    11453       -8     
Flag Coverage Δ
linux 86.05% <98.86%> (+<0.01%) ⬆️
osx 76.06% <98.86%> (+0.01%) ⬆️
other 86.55% <98.86%> (+<0.01%) ⬆️
win 84.39% <98.75%> (+<0.01%) ⬆️

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.

Copy link
Copy Markdown
Member

@blnicho blnicho left a comment

Choose a reason for hiding this comment

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

I'm excited about this change!

@blnicho blnicho merged commit f46e2fd into Pyomo:main Nov 5, 2024
@jsiirola jsiirola deleted the moved-modules branch November 6, 2024 21:24
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