Skip to content

Conversation

@XPRSc4v4
Copy link

@XPRSc4v4 XPRSc4v4 commented Dec 5, 2025

Hi!

Fixes

  • Deprecated function names in Xpress 9.8+ (Python API v46)
  • Removed enums in Xpress 9.8+
  • Compatibility with both pre-9.8 and post-9.8 Xpress versions

Summary/Motivation:

Starting with Xpress 9.8 (Python API version 46), FICO deprecated lowercase function names in favor of camelCase (e.g., lpoptimizelpOptimize) and removed several enum types. The old functions are still available but deprecated, and will be removed in future releases. This PR adds runtime version detection to dispatch to the correct functions and enums based on the installed Xpress version, eliminating deprecation warnings while maintaining backward compatibility.

Changes proposed in this PR:

  • Extended version detection logic that checks Xpress Python API version at runtime
  • Created compatibility wrappers that dispatch to correct function names (lowercase for v45-, camelCase for v46+)
  • Updated enum handling to use new attribute access pattern for v46+ while maintaining old enum values for earlier versions
  • Modified tests to use XpressDirect interface instead of calling Xpress Python APIs directly
  • All changes maintain full backward compatibility with Xpress versions prior to 9.8

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.

* TXP-7757: removed most deprecation warnings up to current unpublished release

* Fixed more warnings

* Missing version agnostic functions

* Fixed version specific LPStatus enums + renamed get-lb/ub methods

* Suggested improvements
@XPRSc4v4 XPRSc4v4 changed the title Remove deprecation warnings (#1) [Xpress] Remove deprecation warnings (#1) Dec 5, 2025
@codecov
Copy link

codecov bot commented Dec 8, 2025

Codecov Report

❌ Patch coverage is 74.82014% with 35 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.40%. Comparing base (dcaba42) to head (13ee044).

Files with missing lines Patch % Lines
pyomo/solvers/plugins/solvers/xpress_direct.py 74.26% 35 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3794      +/-   ##
==========================================
- Coverage   89.42%   88.40%   -1.02%     
==========================================
  Files         909      909              
  Lines      105579   105675      +96     
==========================================
- Hits        94411    93419     -992     
- Misses      11168    12256    +1088     
Flag Coverage Δ
builders 29.13% <28.77%> (+<0.01%) ⬆️
default 86.01% <58.99%> (?)
expensive 35.76% <28.77%> (?)
linux 85.68% <59.71%> (-3.51%) ⬇️
linux_other 85.68% <59.71%> (-1.05%) ⬇️
osx ?
win 84.96% <59.71%> (-0.04%) ⬇️
win_other 84.96% <59.71%> (-0.04%) ⬇️

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.

PYVER=$(echo "py${{matrix.python}}" | sed 's/\.//g')
echo "Installing for $PYVER"
for PKG in 'cplex>=12.10' docplex gurobi "$XPRESS" cyipopt pymumps scip; do
for PKG in 'cplex>=12.10' docplex gurobi "$XPRESS" 'xpress<9.3' cyipopt pymumps scip; do
Copy link
Member

Choose a reason for hiding this comment

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

This is changing the xpress version for every GHA job using conda to install Python packages which is not what I think you intended. During the dev call we talked about installing an older version of xpress on just one or two jobs to exercise the version-specific logic in the solver interface. I think you can do this by modifying the if-tree above that sets the XPRESS environment variable. There is already some special logic there for windows so maybe we use the linux conda job for this. I think you can just modify the else section on line 450 to something like:

if test "${{matrix.TARGET}}" == linux; then
    XPRESS='xpress<9.3'
else
    XPRESS='xpress'
fi

Copy link
Author

Choose a reason for hiding this comment

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

Sorry, I should have asked for clarification during the call!
I've applied the changes, targeting Python 3.10 so the latest Xpress release is still tested in the other jobs. Let me know if there are any other issues.

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