Skip to content

Commit

Permalink
Add support for python 3.11 (#328)
Browse files Browse the repository at this point in the history
* Add support for python 3.11

* Use gurobi 10.0.0 in CI

* Move all dependencies into pyproject.toml
  • Loading branch information
sebheger committed Jan 4, 2023
1 parent d8a3197 commit 6044fc8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/github-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@ jobs:
run: pre-commit run --all-files



test:

runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# temporarily downgraded to 3.7.9 and 3.8.10 due to a bug https://github.com/actions/setup-python/issues/402
python-version: ["3.7.9", "3.8.10", "3.9.13", "3.10.9", "pypy3.9-v7.3.9"]
python-version: ["3.7.9", "3.8.10", "3.9.13", "3.10.9", "3.11.1", "pypy3.9-v7.3.9"]
os: [macos-11, macos-12, ubuntu-20.04, ubuntu-22.04, windows-2019, windows-2022]
exclude:
# temporarily exclude pypy3 on mac-os as there failing tests caused by bug on cbc side
Expand Down Expand Up @@ -82,13 +81,14 @@ jobs:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.python-version }}-pythonpip

- name: Install additional requirements (CPython)
if: ${{ matrix.python-version != 'pypy3.9-v7.3.9' }}
run: python -m pip install "matplotlib==3.5.2" "gurobipy==9.5.1"

- name: Install mip
- name: Install mip for testing (PyPy)
if: ${{ matrix.python-version == 'pypy3.9-v7.3.9' }}
run: python -m pip install .[test,numpy]

- name: Install mip for testing (CPython)
if: ${{ matrix.python-version != 'pypy3.9-v7.3.9' }}
run: python -m pip install .[test,numpy,gurobi]

- name: list installed packages
run: python -m pip list

Expand Down
7 changes: 0 additions & 7 deletions examples/plant_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@

import sys

# If running as a unit test, then skip if under pypy
if hasattr(sys, '_called_from_test') and sys._called_from_test is True:
import platform
if 'pypy' in platform.python_implementation().lower():
import pytest
pytest.skip("Matplotlib installation not working under pypy")

# Workaround for issues with python not being installed as a framework on mac
# by using a different backend.
if sys.platform == "darwin": # OS X
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
name = "mip"
description = "Python tools for Modeling and Solving Mixed-Integer Linear Programs (MIPs)"
readme = "README.md"
requires-python = ">=3.7,<3.11"
requires-python = ">=3.7,<3.12"
license = {file = "LICENSE"}
authors = [
{name="T.A.M. Toffolo", email="[email protected]"},
Expand All @@ -32,12 +32,12 @@ classifiers = [
]
dynamic = ["version"]

dependencies = ["cffi==1.15.0"]
dependencies = ["cffi==1.15.*"]

[project.optional-dependencies]
numpy = ["numpy==1.24.1; python_version >= '3.8'", "numpy==1.21.6; python_version == '3.7'"]
numpy = ["numpy==1.24.*; python_version >= '3.8'", "numpy==1.21.6; python_version == '3.7'"]
gurobi = ["gurobipy>=8"]
test = ["pytest==7.2.0", "networkx==2.6.3"]
test = ["pytest==7.2.0", "networkx==2.8.8; python_version >= '3.8'", "networkx==2.6.3; python_version == '3.7'", "matplotlib==3.6.2; python_version >= '3.8'", "matplotlib==3.5.3; python_version == '3.7'"]

[project.urls]
"Homepage" = "https://www.python-mip.com"
Expand Down

0 comments on commit 6044fc8

Please sign in to comment.