From 53ce3b32bfab2f9feaf6019be6ac34d08d37a3bb Mon Sep 17 00:00:00 2001 From: Christian Diener Date: Tue, 26 Nov 2024 08:41:31 +0100 Subject: [PATCH 01/10] switch to conditional additional solvers --- .github/workflows/release.yml | 2 +- .github/workflows/test.yml | 2 +- tox.ini | 22 +++++++++++++++------- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f42424c..eb8f5d5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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. diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5cf7a8c..5e77184 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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"] steps: - uses: actions/checkout@v4 diff --git a/tox.ini b/tox.ini index 4e09b02..d62cf09 100644 --- a/tox.ini +++ b/tox.ini @@ -1,12 +1,19 @@ [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 + py311-solvers [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.11: safety, py311, py311-symengine, py311-solvers + 3.13: safety, py313, py313-symengine ;[testenv] ;deps = @@ -25,12 +32,13 @@ deps = pytest pytest-cov scipy - numpy >=1.13,<1.24 + numpy >=1.13 osqp >=0.6.2 mip >=1.9.1 highspy >=1.5.3 - cplex - gurobipy + solvers: + cplex + gurobipy symengine: symengine passenv = CI commands = From 5efeb03cc06cba2359dce542df7b11af1602e136 Mon Sep 17 00:00:00 2001 From: Christian Diener Date: Tue, 26 Nov 2024 08:44:18 +0100 Subject: [PATCH 02/10] add RNs --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8db42be..1bbc3ed 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -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 ----- From 556dd4c1bbb0833d7811bfdb36d77fec48ffa9c2 Mon Sep 17 00:00:00 2001 From: Christian Diener Date: Tue, 26 Nov 2024 08:45:30 +0100 Subject: [PATCH 03/10] no idea how this syntax works --- tox.ini | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tox.ini b/tox.ini index d62cf09..1e99dcd 100644 --- a/tox.ini +++ b/tox.ini @@ -36,9 +36,7 @@ deps = osqp >=0.6.2 mip >=1.9.1 highspy >=1.5.3 - solvers: - cplex - gurobipy + solvers: cplex, gurobipy symengine: symengine passenv = CI commands = From 1f0ca38cd9267f0d810b64646b116fd5a45e7e3f Mon Sep 17 00:00:00 2001 From: Christian Diener Date: Tue, 26 Nov 2024 08:48:57 +0100 Subject: [PATCH 04/10] no idea how this syntax works --- tox.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 1e99dcd..0720d4c 100644 --- a/tox.ini +++ b/tox.ini @@ -36,7 +36,8 @@ deps = osqp >=0.6.2 mip >=1.9.1 highspy >=1.5.3 - solvers: cplex, gurobipy + solvers: cplex + solvers: gurobipy symengine: symengine passenv = CI commands = From 4d3f8106af0196c1163739aaa8337e719efdc4ca Mon Sep 17 00:00:00 2001 From: Christian Diener Date: Tue, 26 Nov 2024 08:55:19 +0100 Subject: [PATCH 05/10] try this --- tox.ini | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tox.ini b/tox.ini index 0720d4c..5737211 100644 --- a/tox.ini +++ b/tox.ini @@ -12,7 +12,7 @@ envlist = [gh-actions] python = 3.9: safety, py39, py39-symengine - 3.11: safety, py311, py311-symengine, py311-solvers + 3.11: safety, py311, py311-symengine 3.13: safety, py313, py313-symengine ;[testenv] @@ -34,10 +34,10 @@ deps = scipy numpy >=1.13 osqp >=0.6.2 - mip >=1.9.1 + mip >=1.9.1; python_version < "3.13" highspy >=1.5.3 - solvers: cplex - solvers: gurobipy + cplex; python_version < "3.12" + gurobipy; python_version < "3.13" symengine: symengine passenv = CI commands = From c0f736b351d000493f0695dd0af57f93918002b8 Mon Sep 17 00:00:00 2001 From: Christian Diener Date: Tue, 26 Nov 2024 09:04:28 +0100 Subject: [PATCH 06/10] change the dir test --- src/optlang/tests/test_container.py | 10 ++++------ tox.ini | 1 - 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/optlang/tests/test_container.py b/src/optlang/tests/test_container.py index 444740e..1968643 100644 --- a/src/optlang/tests/test_container.py +++ b/src/optlang/tests/test_container.py @@ -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(attribute in dir(self.container) + 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)] diff --git a/tox.ini b/tox.ini index 5737211..47d1edf 100644 --- a/tox.ini +++ b/tox.ini @@ -7,7 +7,6 @@ envlist = docs py3{9,11,13} py3{9,11,13}-symengine - py311-solvers [gh-actions] python = From a1fc191eb321d439e55d9e78ed333d178f3ceb78 Mon Sep 17 00:00:00 2001 From: Christian Diener Date: Wed, 11 Dec 2024 10:42:03 +0100 Subject: [PATCH 07/10] Update src/optlang/tests/test_container.py Co-authored-by: Moritz E. Beber --- src/optlang/tests/test_container.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/optlang/tests/test_container.py b/src/optlang/tests/test_container.py index 1968643..dc7fd05 100644 --- a/src/optlang/tests/test_container.py +++ b/src/optlang/tests/test_container.py @@ -48,7 +48,7 @@ def test_dir(self): self.container.append(var) print(dir(self.container)) self.assertTrue( - all(attribute in dir(self.container) + all(hasattr(self.container, attribute) for attribute in ['__contains__', 'keys', 'values']) ) From 97fcbc6cf81dac4602e2602c7f49cfa5ce14aa40 Mon Sep 17 00:00:00 2001 From: Christian Diener Date: Tue, 7 Jan 2025 12:36:15 +0100 Subject: [PATCH 08/10] update swiglpk --- setup.cfg | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index 277a987..3efa194 100644 --- a/setup.cfg +++ b/setup.cfg @@ -15,10 +15,11 @@ classifiers = License :: OSI Approved :: Apache Software License Natural Language :: English Operating System :: OS Independent - Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 + Programming Language :: Python :: 3.13 Topic :: Scientific/Engineering :: Mathematics license = Apache-2.0 description = Formulate optimization problems using sympy expressions and solve them using interfaces to third-party optimization software (e.g. GLPK). @@ -33,9 +34,9 @@ keywords = [options] zip_safe = True install_requires = - swiglpk >=5.0.8 + swiglpk >=5.0.12 sympy >=1.12.0 -python_requires = >=3.8 +python_requires = >=3.9 tests_require = tox packages = find: From 8668d798b5252a86097eab17955354e87f06aafb Mon Sep 17 00:00:00 2001 From: Christian Diener Date: Tue, 7 Jan 2025 12:42:32 +0100 Subject: [PATCH 09/10] pin scipy to lower version to not break highs --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 47d1edf..b2d25a5 100644 --- a/tox.ini +++ b/tox.ini @@ -30,7 +30,7 @@ deps = jsonschema pytest pytest-cov - scipy + scipy <=1.14 # until https://github.com/scipy/scipy/issues/22257 is fixed numpy >=1.13 osqp >=0.6.2 mip >=1.9.1; python_version < "3.13" From 5fe1645a155103ffb0c320ed0a294efe7573cf7c Mon Sep 17 00:00:00 2001 From: Christian Diener Date: Tue, 7 Jan 2025 13:06:56 +0100 Subject: [PATCH 10/10] fix req --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index b2d25a5..fe236e9 100644 --- a/tox.ini +++ b/tox.ini @@ -30,7 +30,7 @@ deps = jsonschema pytest pytest-cov - scipy <=1.14 # until https://github.com/scipy/scipy/issues/22257 is fixed + scipy <1.15.0 # until https://github.com/scipy/scipy/issues/22257 is fixed numpy >=1.13 osqp >=0.6.2 mip >=1.9.1; python_version < "3.13"