Skip to content

Commit

Permalink
Special handling to get CVXOPT version number properly
Browse files Browse the repository at this point in the history
  • Loading branch information
stephane-caron committed Sep 2, 2024
1 parent 1b2ace3 commit 6c7953b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
### Added

- Add `results_path` argument to the `main` function
- Special handling to get CVXOPT version number properly

### Changed

Expand Down
14 changes: 6 additions & 8 deletions qpbenchmark/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,18 @@ def get_solver_versions(solvers: Set[str]):
"hpipm": "hpipm_python",
"proxqp": "proxsuite",
}
package_name = {
solver: solver if solver not in diff else diff[solver]
for solver in solvers
}
package_names = {solver: diff.get(solver, solver) for solver in solvers}
versions = {}
for solver, package in package_name.items():
for solver, package_name in package_names.items():
try:
versions[solver] = metadata.version(package)
versions[solver] = metadata.version(package_name)
except metadata.PackageNotFoundError:
pass
if solver in versions:
if solver in versions and solver != "cvxopt":
# For some reason, metadata.versions("cvxopt") returns 0.0.0
continue
try:
module = import_module(package)
module = import_module(package_name)
versions[solver] = module.__version__
except AttributeError:
pass
Expand Down

0 comments on commit 6c7953b

Please sign in to comment.