Skip to content

Commit

Permalink
Drop support for Python < 3.7 (#386)
Browse files Browse the repository at this point in the history
* Bumped version for breaking release.

* Drop support for Python 2.7, 3.5, 3.6.

---------

Co-authored-by: Jens Vagelpohl <jens@plyp.com>
  • Loading branch information
Michael Howitz and dataflake authored Jul 19, 2023
1 parent 198bfdf commit 6f88781
Show file tree
Hide file tree
Showing 123 changed files with 923 additions and 1,445 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,19 @@ jobs:
config:
# [Python version, tox env]
- ["3.9", "lint"]
- ["2.7", "py27"]
- ["3.5", "py35"]
- ["3.6", "py36"]
- ["3.7", "py37"]
- ["3.8", "py38"]
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["3.11", "py311"]
- ["pypy-2.7", "pypy"]
- ["pypy-3.7", "pypy3"]
- ["pypy-3.9", "pypy3"]
- ["3.9", "docs"]
- ["3.9", "coverage"]
- ["3.8", "py38-pure"]
- ["3.10", "py310-pure"]
exclude:
- { os: ["windows", "windows-latest"], config: ["3.9", "lint"] }
- { os: ["windows", "windows-latest"], config: ["3.9", "docs"] }
- { os: ["windows", "windows-latest"], config: ["3.9", "coverage"] }
- { os: ["windows", "windows-latest"], config: ["pypy-2.7", "pypy"] }

runs-on: ${{ matrix.os[1] }}
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
Expand Down Expand Up @@ -67,7 +62,7 @@ jobs:
- name: Coverage
if: matrix.config[1] == 'coverage'
run: |
pip install coveralls coverage-python-version
pip install coveralls
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15 changes: 6 additions & 9 deletions .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
[meta]
template = "pure-python"
commit-id = "b4dd6f9ffd3d6a2cde7dc70512c62d4c7ed22cd6"
commit-id = "b99ba750"

[python]
with-windows = true
with-pypy = true
with-future-python = false
with-legacy-python = true
with-docs = true
with-sphinx-doctests = false
with-macos = false

[tox]
use-flake8 = true
Expand All @@ -21,12 +21,12 @@ testenv-setenv = [
"ZOPE_INTERFACE_STRICT_IRO=1",
]
additional-envlist = [
"py38-pure",
"py310-pure",
]
testenv-additional = [
"",
"[testenv:py38-pure]",
"basepython = python3.8",
"[testenv:py310-pure]",
"basepython = python3.10",
"setenv =",
" PURE_PYTHON = 1",
]
Expand Down Expand Up @@ -67,8 +67,5 @@ additional-ignores = [

[github-actions]
additional-config = [
"- [\"3.8\", \"py38-pure\"]",
]
additional-exclude = [
"- { os: windows, config: [\"pypy-2.7\", \"pypy\"] }",
"- [\"3.10\", \"py310-pure\"]",
]
6 changes: 4 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
Change History
================

5.8.2 (unreleased)
==================
6.0 (unreleased)
================

- Drop support for Python 2.7, 3.5, 3.6.


5.8.1 (2023-07-18)
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
[bdist_wheel]
universal = 1
universal = 0

[flake8]
doctests = 1
Expand All @@ -26,7 +26,7 @@ ignore =
force_single_line = True
combine_as_imports = True
sections = FUTURE,STDLIB,THIRDPARTY,ZOPE,FIRSTPARTY,LOCALFOLDER
known_third_party = six, docutils, pkg_resources
known_third_party = docutils, pkg_resources, pytz
known_zope =
known_first_party =
default_section = ZOPE
Expand Down
50 changes: 21 additions & 29 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,7 @@
from setuptools import setup


version = '5.8.2.dev0'

classifiers = """\
Intended Audience :: Developers
License :: OSI Approved :: Zope Public License
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: PyPy
Topic :: Database
Topic :: Software Development :: Libraries :: Python Modules
Operating System :: Microsoft :: Windows
Operating System :: Unix
Framework :: ZODB
"""
version = '6.0.dev0'


def read(path):
Expand All @@ -50,7 +27,6 @@ def read(path):

tests_require = [
'manuel',
'mock; python_version == "2.7"',
'zope.testing',
'zope.testrunner >= 4.4.6',
]
Expand All @@ -61,14 +37,31 @@ def read(path):
author="Jim Fulton",
author_email="jim@zope.com",
maintainer="Zope Foundation and Contributors",
maintainer_email="zodb-dev@zope.org",
maintainer_email="zodb-dev@zope.dev",
keywords="database nosql python zope",
packages=find_packages('src'),
package_dir={'': 'src'},
url='http://zodb-docs.readthedocs.io',
license="ZPL 2.1",
platforms=["any"],
classifiers=list(filter(None, classifiers.split("\n"))),
classifiers=[
"Intended Audience :: Developers",
"License :: OSI Approved :: Zope Public License",
"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",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Database",
"Topic :: Software Development :: Libraries :: Python Modules",
"Operating System :: Microsoft :: Windows",
"Operating System :: Unix",
"Framework :: ZODB",
],
description=long_description.split('\n', 2)[1],
long_description=long_description,
tests_require=tests_require,
Expand All @@ -87,7 +80,6 @@ def read(path):
'BTrees >= 4.2.0',
'ZConfig',
'transaction >= 2.4',
'six',
'zc.lockfile',
'zope.interface',
'zodbpickle >= 1.0.1',
Expand All @@ -102,5 +94,5 @@ def read(path):
repozo = ZODB.scripts.repozo:main
""",
include_package_data=True,
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*',
python_requires='>=3.7',
)
2 changes: 1 addition & 1 deletion src/ZODB/ActivityMonitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from . import utils


class ActivityMonitor(object):
class ActivityMonitor:
"""ZODB load/store activity monitor
This simple implementation just keeps a small log in memory
Expand Down
15 changes: 9 additions & 6 deletions src/ZODB/BaseStorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
The base class here is tightly coupled with its subclasses and
its use is not recommended. It's still here for historical reasons.
"""
from __future__ import print_function

import logging
import time
Expand All @@ -30,7 +29,6 @@

from . import POSException
from . import utils
from ._compat import py2_hasattr
from .Connection import TransactionMetaData
from .UndoLogCompatible import UndoLogCompatible
from .utils import byte_chr
Expand Down Expand Up @@ -310,7 +308,12 @@ def copy(source, dest, verbose=0):
# using store(). However, if we use store, then
# copyTransactionsFrom() may fail with VersionLockError or
# ConflictError.
restoring = py2_hasattr(dest, 'restore')
try:
getattr(dest, 'restore')
except: # noqa: E722 do not use bare 'except'
restoring = False
else:
restoring = True
fiter = source.iterator()
for transaction in fiter:
tid = transaction.tid
Expand All @@ -320,14 +323,14 @@ def copy(source, dest, verbose=0):
t = TimeStamp(tid)
if t <= _ts:
if ok:
print(('Time stamps out of order %s, %s' % (_ts, t)))
print('Time stamps out of order {}, {}'.format(_ts, t))
ok = 0
_ts = t.laterThan(_ts)
tid = _ts.raw()
else:
_ts = t
if not ok:
print(('Time stamps back in order %s' % (t)))
print('Time stamps back in order %s' % (t))
ok = 1

if verbose:
Expand Down Expand Up @@ -376,7 +379,7 @@ def __init__(self, tid, status, user, description, extension):


@zope.interface.implementer(ZODB.interfaces.IStorageRecordInformation)
class DataRecord(object):
class DataRecord:
"""Abstract base class for iterator protocol"""

version = ''
Expand Down
27 changes: 10 additions & 17 deletions src/ZODB/ConflictResolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,11 @@
##############################################################################

import logging
# Subtle: Python 2.x has pickle.PicklingError and cPickle.PicklingError,
# and these are unrelated classes! So we shouldn't use pickle.PicklingError,
# since on Python 2, ZODB._compat.pickle is cPickle.
from io import BytesIO
from pickle import PicklingError

import six

import zope.interface

from ZODB._compat import BytesIO
from ZODB._compat import PersistentPickler
from ZODB._compat import PersistentUnpickler
from ZODB._compat import _protocol
Expand All @@ -37,7 +32,7 @@ class BadClassName(Exception):
pass


class BadClass(object):
class BadClass:

def __init__(self, *args):
self.args = args
Expand Down Expand Up @@ -68,8 +63,8 @@ def find_global(*args):
if cls == 1:
# Not importable
if (isinstance(args, tuple) and len(args) == 2 and
isinstance(args[0], six.string_types) and
isinstance(args[1], six.string_types)):
isinstance(args[0], str) and
isinstance(args[1], str)):
return BadClass(*args)
else:
raise BadClassName(*args)
Expand Down Expand Up @@ -125,7 +120,7 @@ class may have its own comparison, and we have no idea what it is.


@zope.interface.implementer(IPersistentReference)
class PersistentReference(object):
class PersistentReference:

weak = False
oid = database_name = klass = None
Expand Down Expand Up @@ -169,7 +164,7 @@ def __init__(self, data):
self.weak = True
if not isinstance(self.oid, (bytes, type(None))):
assert isinstance(self.oid, str)
# this happens on Python 3 when all bytes in the oid are < 0x80
# this happens when all bytes in the oid are < 0x80
self.oid = self.oid.encode('ascii')

def __cmp__(self, other):
Expand All @@ -185,8 +180,6 @@ def __cmp__(self, other):
"can't reliably compare against different "
"PersistentReferences")

# Python 3 dropped __cmp__

def __eq__(self, other):
return self.__cmp__(other) == 0

Expand All @@ -206,7 +199,7 @@ def __ge__(self, other):
return self.__cmp__(other) >= 0

def __repr__(self):
return "PR(%s %s)" % (id(self), self.data)
return "PR({} {})".format(id(self), self.data)

def __getstate__(self):
raise PicklingError("Can't pickle PersistentReference")
Expand All @@ -221,7 +214,7 @@ def klass(self):
return data[1][2]


class PersistentReferenceFactory(object):
class PersistentReferenceFactory:

data = None

Expand Down Expand Up @@ -311,7 +304,7 @@ def tryToResolveConflict(self, oid, committedSerial, oldSerial, newpickle,
data=newpickle)


class ConflictResolvingStorage(object):
class ConflictResolvingStorage:
"Mix-in class that provides conflict resolution handling for storages"

tryToResolveConflict = tryToResolveConflict
Expand All @@ -323,7 +316,7 @@ def registerDB(self, wrapper):
self._crs_untransform_record_data = wrapper.untransform_record_data
self._crs_transform_record_data = wrapper.transform_record_data
try:
m = super(ConflictResolvingStorage, self).registerDB
m = super().registerDB
except AttributeError:
pass
else:
Expand Down
Loading

0 comments on commit 6f88781

Please sign in to comment.