Skip to content

Commit

Permalink
Remove Python 3.7 support
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmundt committed Aug 17, 2023
1 parent 99dc0f1 commit a5945e5
Show file tree
Hide file tree
Showing 19 changed files with 25 additions and 80 deletions.
2 changes: 1 addition & 1 deletion .coin-or/projDesc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ Carl D. Laird, Chair, Pyomo Management Committee, claird at andrew dot cmu dot e

<platform>
<operatingSystem>Any</operatingSystem>
<compiler>Python 3.7, 3.8, 3.9, 3.10, 3.11</compiler>
<compiler>Python 3.8, 3.9, 3.10, 3.11</compiler>
</platform>

</testedPlatforms>
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release_wheel_creation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
strategy:
fail-fast: false
matrix:
wheel-version: ['cp37-cp37m', 'cp38-cp38', 'cp39-cp39', 'cp310-cp310', 'cp311-cp311']
wheel-version: ['cp38-cp38', 'cp39-cp39', 'cp310-cp310', 'cp311-cp311']
os: [ubuntu-latest]
include:
- os: ubuntu-latest
Expand Down Expand Up @@ -102,7 +102,7 @@ jobs:
include:
- os: macos-latest
TARGET: osx
python-version: [ 3.7, 3.8, 3.9, '3.10', '3.11' ]
python-version: [ 3.8, 3.9, '3.10', '3.11' ]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand Down Expand Up @@ -133,7 +133,7 @@ jobs:
include:
- os: windows-latest
TARGET: win
python-version: [ 3.7, 3.8, 3.9, '3.10', '3.11' ]
python-version: [ 3.8, 3.9, '3.10', '3.11' ]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test_pr_and_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: [3.7, 3.8, 3.9, '3.10', '3.11']
python: [ 3.8, 3.9, '3.10', '3.11' ]
other: [""]
category: [""]

Expand All @@ -83,7 +83,7 @@ jobs:
PACKAGES:

- os: ubuntu-latest
python: 3.8
python: 3.9
other: /mpi
mpi: 3
skip_doctest: 1
Expand Down Expand Up @@ -116,15 +116,15 @@ jobs:
PYENV: pip

- os: ubuntu-latest
python: 3.7
python: 3.8
other: /slim
slim: 1
skip_doctest: 1
TARGET: linux
PYENV: pip

- os: ubuntu-latest
python: 3.8
python: 3.9
other: /pyutilib
TARGET: linux
PYENV: pip
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Pyomo is available under the BSD License - see the

Pyomo is currently tested with the following Python implementations:

* CPython: 3.7, 3.8, 3.9, 3.10, 3.11
* CPython: 3.8, 3.9, 3.10, 3.11
* PyPy: 3.7, 3.8, 3.9

_Testing and support policy_:
Expand Down
2 changes: 1 addition & 1 deletion doc/OnlineDocs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Installation

Pyomo currently supports the following versions of Python:

* CPython: 3.7, 3.8, 3.9, 3.10, 3.11
* CPython: 3.8, 3.9, 3.10, 3.11
* PyPy: 3

At the time of the first Pyomo release after the end-of-life of a minor Python
Expand Down
22 changes: 0 additions & 22 deletions pyomo/common/backports.py

This file was deleted.

11 changes: 1 addition & 10 deletions pyomo/common/plugin_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,12 @@
# the U.S. Government retains certain rights in this software.
# ___________________________________________________________________________

import collections
import inspect
import sys
from weakref import ref as weakref_ref

from pyomo.common.errors import PyomoException
from pyomo.common.deprecation import deprecated, deprecation_warning

if sys.version_info[:2] >= (3, 7):
_deterministic_dict = dict
else:
from pyomo.common.collections import OrderedDict

_deterministic_dict = OrderedDict


class PluginGlobals(object):
@staticmethod
Expand Down Expand Up @@ -206,7 +197,7 @@ def __new__(cls, name, bases, classdict, *args, **kwargs):

# Register the new class with the interfaces
for interface, inherit, service in implements:
interface._plugins[new_class] = _deterministic_dict()
interface._plugins[new_class] = {}
interface._aliases.update({name: (new_class, doc) for name, doc in aliases})

if _singleton:
Expand Down
9 changes: 1 addition & 8 deletions pyomo/common/tests/test_deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#
"""Testing for deprecated function."""
import sys
import types
import weakref

import pyomo.common.unittest as unittest

Expand Down Expand Up @@ -368,10 +366,6 @@ def test_relocated_class(self):

from pyomo.common.tests import relocated

if sys.version_info < (3, 5):
# Make sure that the module is only wrapped once
self.assertIs(type(relocated._wrapped_module), types.ModuleType)

self.assertNotIn('Foo', dir(relocated))
self.assertNotIn('Foo_2', dir(relocated))

Expand Down Expand Up @@ -414,8 +408,7 @@ def test_relocated_class(self):
"(?:'module' object) has no attribute 'Baz'",
):
relocated.Baz.data
if sys.version_info[:2] >= (3, 7):
self.assertEqual(relocated.Foo_3, '_3')
self.assertEqual(relocated.Foo_3, '_3')

with self.assertRaisesRegex(
AttributeError,
Expand Down
9 changes: 0 additions & 9 deletions pyomo/common/tests/test_fileutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,6 @@ def test_findfile(self):
os.path.join(subdir, subdir_name),
)

# TODO: Remove this when Python 3.7 is no longer supported
@unittest.skipIf(
sys.version_info[:2] < (3, 8)
and (
platform.mac_ver()[0].startswith('10.16')
or platform.mac_ver()[0].startswith('12.6')
),
"find_library has known bugs in Big Sur/Monterey for Python<3.8",
)
def test_find_library_system(self):
# Find a system library (before we muck with the PATH)
_args = {'cwd': False, 'include_PATH': False, 'pathlist': []}
Expand Down
5 changes: 3 additions & 2 deletions pyomo/contrib/incidence_analysis/incidence.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
# ___________________________________________________________________________
"""Functionality for identifying variables that participate in expressions
"""
import enum

from contextlib import nullcontext

from pyomo.core.expr.visitor import identify_variables
from pyomo.core.expr.numvalue import value as pyo_value
from pyomo.repn import generate_standard_repn
from pyomo.common.backports import nullcontext
from pyomo.util.subsystems import TemporarySubsystemManager
from pyomo.contrib.incidence_analysis.config import IncidenceMethod, IncidenceConfig

Expand Down
4 changes: 0 additions & 4 deletions pyomo/core/base/set.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@

logger = logging.getLogger('pyomo.core')

_prePython37 = sys.version_info[:2] < (3, 7)

_inf = float('inf')

FLATTEN_CROSS_PRODUCT = True
Expand Down Expand Up @@ -1950,8 +1948,6 @@ class SortedOrder(object):

_ValidOrderedAuguments = {True, False, InsertionOrder, SortedOrder}
_UnorderedInitializers = {set}
if _prePython37:
_UnorderedInitializers.add(dict)

def __new__(cls, *args, **kwds):
if cls is not Set:
Expand Down
2 changes: 1 addition & 1 deletion pyomo/core/expr/expr_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
# ___________________________________________________________________________

import enum
from contextlib import nullcontext

from pyomo.common.backports import nullcontext
from pyomo.common.deprecation import deprecated

TO_STRING_VERBOSE = False
Expand Down
4 changes: 2 additions & 2 deletions pyomo/core/expr/template_expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
# This software is distributed under the 3-clause BSD License.
# ___________________________________________________________________________

import copy
import itertools
import logging
import sys
import builtins
from contextlib import nullcontext

from pyomo.common.backports import nullcontext
from pyomo.common.errors import TemplateExpressionError
from pyomo.core.expr.base import ExpressionBase, ExpressionArgs_Mixin, NPV_Mixin
from pyomo.core.expr.logical_expr import BooleanExpression
Expand All @@ -25,6 +24,7 @@
Numeric_NPV_Mixin,
register_arg_type,
ARG_TYPE,
_balanced_parens,
)
from pyomo.core.expr.numvalue import (
NumericValue,
Expand Down
3 changes: 0 additions & 3 deletions pyomo/environ/tests/test_environ.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@ def test_not_auto_imported(self):
"pyomo.environ and it should not."
)

@unittest.skipIf(
sys.version_info[:2] < (3, 7), "Import timing introduced in python 3.7"
)
@unittest.skipIf(
'pypy_version_info' in dir(sys), "PyPy does not support '-X importtime"
)
Expand Down
2 changes: 1 addition & 1 deletion pyomo/opt/solver/shellcmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import logging
import subprocess
from io import StringIO
from contextlib import nullcontext

from pyomo.common.backports import nullcontext
from pyomo.common.errors import ApplicationError
from pyomo.common.collections import Bunch
from pyomo.common.log import is_debug_set, LoggingIntercept
Expand Down
2 changes: 1 addition & 1 deletion pyomo/repn/plugins/baron_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import logging
import math
from io import StringIO
from contextlib import nullcontext

from pyomo.common.backports import nullcontext
from pyomo.common.collections import OrderedSet
from pyomo.opt import ProblemFormat
from pyomo.opt.base import AbstractProblemWriter, WriterFactory
Expand Down
2 changes: 1 addition & 1 deletion pyomo/repn/plugins/nl_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import os
from collections import deque
from operator import itemgetter, attrgetter, setitem
from contextlib import nullcontext

from pyomo.common.backports import nullcontext
from pyomo.common.config import (
ConfigBlock,
ConfigValue,
Expand Down
7 changes: 3 additions & 4 deletions pyomo/repn/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,14 @@ class FileDeterminism(enum.IntEnum):
SORT_SYMBOLS = 30

# We will define __str__ and __format__ so that behavior in python
# 3.11 is consistent with 3.7 - 3.10.
# 3.11 is consistent with 3.8 - 3.10.

def __str__(self):
return enum.Enum.__str__(self)

def __format__(self, spec):
# This cannot just call Enum.__format__ because that returns the
# numeric value in Python 3.7
return str(self).__format__(spec)
# Removal of Python 3.7 support allows us to use Enum.__format__
return enum.Enum.__format__(self, spec)

@classmethod
def _missing_(cls, value):
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ def _print_deps(self, deplist):
'Operating System :: Unix',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
Expand All @@ -217,7 +216,7 @@ def _print_deps(self, deplist):
'Topic :: Scientific/Engineering :: Mathematics',
'Topic :: Software Development :: Libraries :: Python Modules',
],
python_requires='>=3.7',
python_requires='>=3.8',
install_requires=['ply'],
extras_require={
'tests': [
Expand Down

0 comments on commit a5945e5

Please sign in to comment.