Skip to content
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

Enable Python 3.13 and make tests more resilient to lacking cplex/gurobi wheels #276

Merged
merged 10 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.11"]
python-version: ["3.13"]
runs-on: ${{ matrix.os }}
permissions:
# Write permissions are needed to create OIDC tokens.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-13, windows-latest]
python-version: ["3.8", "3.11"]
python-version: ["3.9", "3.11", "3.13"]
Copy link
Member

Choose a reason for hiding this comment

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

Lowest and highest version is good enough in my opinion.

Suggested change
python-version: ["3.9", "3.11", "3.13"]
python-version: ["3.9", "3.13"]

Copy link
Member Author

Choose a reason for hiding this comment

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

I had 3.11 because it is the latest version that supports all solvers. But it would work with 3.9 but 3.11 pulls in much newer dependencies and I thought it might be good to test this.

Copy link
Member

Choose a reason for hiding this comment

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

Okay, that makes sense :slight_smile:


steps:
- uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Next Release
* enable compatibility with Gurobi 12.0
* fix an issue where the removal of more than 350 constraints
would lead to dangling references
* add support for Python 3.13

1.8.2
-----
Expand Down
10 changes: 4 additions & 6 deletions src/optlang/tests/test_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,10 @@ def test_dir(self):
var = Variable('blub')
self.container.append(var)
print(dir(self.container))
self.assertEqual(dir(self.container),
['__contains__', '__delitem__', '__dict__', '__dir__', '__doc__', '__getattr__', '__getitem__',
'__getstate__', '__init__', '__iter__', '__len__', '__module__', '__setitem__',
'__setstate__', '__weakref__', '_check_for_name_attribute', '_reindex', 'append', 'blub',
'clear', 'extend', 'fromkeys', 'get', 'has_key', 'items', 'iteritems', 'iterkeys',
'itervalues', 'keys', 'update_key', 'values'])
self.assertTrue(
all(hasattr(self.container, attribute)
for attribute in ['__contains__', 'keys', 'values'])
)

def test_del_by_index(self):
variables_iterable = [Variable("v" + str(i), lb=10, ub=100) for i in range(1000)]
Expand Down
20 changes: 13 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
[tox]
envlist = isort, black, flake8, safety, docs, py3{8,9,10,11}, py3{8,9,10,11}-symengine
envlist =
isort
black
flake8
safety
docs
py3{9,11,13}
py3{9,11,13}-symengine

[gh-actions]
python =
3.8: safety, py38, py38-symengine
3.9: safety, py39, py39-symengine
3.10: safety, py310, py310-symengine
3.11: safety, py311, py311-symengine
3.13: safety, py313, py313-symengine

;[testenv]
;deps =
Expand All @@ -25,12 +31,12 @@ deps =
pytest
pytest-cov
scipy
numpy >=1.13,<1.24
numpy >=1.13
osqp >=0.6.2
mip >=1.9.1
mip >=1.9.1; python_version < "3.13"
highspy >=1.5.3
cplex
gurobipy
cplex; python_version < "3.12"
gurobipy; python_version < "3.13"
symengine: symengine
passenv = CI
commands =
Expand Down
Loading