Skip to content

Commit 6f88781

Browse files
Michael Howitzdataflake
Michael Howitz
andauthored
Drop support for Python < 3.7 (#386)
* Bumped version for breaking release. * Drop support for Python 2.7, 3.5, 3.6. --------- Co-authored-by: Jens Vagelpohl <[email protected]>
1 parent 198bfdf commit 6f88781

File tree

123 files changed

+923
-1445
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+923
-1445
lines changed

.github/workflows/tests.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,19 @@ jobs:
2222
config:
2323
# [Python version, tox env]
2424
- ["3.9", "lint"]
25-
- ["2.7", "py27"]
26-
- ["3.5", "py35"]
27-
- ["3.6", "py36"]
2825
- ["3.7", "py37"]
2926
- ["3.8", "py38"]
3027
- ["3.9", "py39"]
3128
- ["3.10", "py310"]
3229
- ["3.11", "py311"]
33-
- ["pypy-2.7", "pypy"]
34-
- ["pypy-3.7", "pypy3"]
30+
- ["pypy-3.9", "pypy3"]
3531
- ["3.9", "docs"]
3632
- ["3.9", "coverage"]
37-
- ["3.8", "py38-pure"]
33+
- ["3.10", "py310-pure"]
3834
exclude:
3935
- { os: ["windows", "windows-latest"], config: ["3.9", "lint"] }
4036
- { os: ["windows", "windows-latest"], config: ["3.9", "docs"] }
4137
- { os: ["windows", "windows-latest"], config: ["3.9", "coverage"] }
42-
- { os: ["windows", "windows-latest"], config: ["pypy-2.7", "pypy"] }
4338

4439
runs-on: ${{ matrix.os[1] }}
4540
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
@@ -67,7 +62,7 @@ jobs:
6762
- name: Coverage
6863
if: matrix.config[1] == 'coverage'
6964
run: |
70-
pip install coveralls coverage-python-version
65+
pip install coveralls
7166
coveralls --service=github
7267
env:
7368
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.meta.toml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
33
[meta]
44
template = "pure-python"
5-
commit-id = "b4dd6f9ffd3d6a2cde7dc70512c62d4c7ed22cd6"
5+
commit-id = "b99ba750"
66

77
[python]
88
with-windows = true
99
with-pypy = true
1010
with-future-python = false
11-
with-legacy-python = true
1211
with-docs = true
1312
with-sphinx-doctests = false
13+
with-macos = false
1414

1515
[tox]
1616
use-flake8 = true
@@ -21,12 +21,12 @@ testenv-setenv = [
2121
"ZOPE_INTERFACE_STRICT_IRO=1",
2222
]
2323
additional-envlist = [
24-
"py38-pure",
24+
"py310-pure",
2525
]
2626
testenv-additional = [
2727
"",
28-
"[testenv:py38-pure]",
29-
"basepython = python3.8",
28+
"[testenv:py310-pure]",
29+
"basepython = python3.10",
3030
"setenv =",
3131
" PURE_PYTHON = 1",
3232
]
@@ -67,8 +67,5 @@ additional-ignores = [
6767

6868
[github-actions]
6969
additional-config = [
70-
"- [\"3.8\", \"py38-pure\"]",
71-
]
72-
additional-exclude = [
73-
"- { os: windows, config: [\"pypy-2.7\", \"pypy\"] }",
70+
"- [\"3.10\", \"py310-pure\"]",
7471
]

CHANGES.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
Change History
33
================
44

5-
5.8.2 (unreleased)
6-
==================
5+
6.0 (unreleased)
6+
================
7+
8+
- Drop support for Python 2.7, 3.5, 3.6.
79

810

911
5.8.1 (2023-07-18)

setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Generated from:
22
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
33
[bdist_wheel]
4-
universal = 1
4+
universal = 0
55

66
[flake8]
77
doctests = 1
@@ -26,7 +26,7 @@ ignore =
2626
force_single_line = True
2727
combine_as_imports = True
2828
sections = FUTURE,STDLIB,THIRDPARTY,ZOPE,FIRSTPARTY,LOCALFOLDER
29-
known_third_party = six, docutils, pkg_resources
29+
known_third_party = docutils, pkg_resources, pytz
3030
known_zope =
3131
known_first_party =
3232
default_section = ZOPE

setup.py

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,7 @@
1515
from setuptools import setup
1616

1717

18-
version = '5.8.2.dev0'
19-
20-
classifiers = """\
21-
Intended Audience :: Developers
22-
License :: OSI Approved :: Zope Public License
23-
Programming Language :: Python
24-
Programming Language :: Python :: 2
25-
Programming Language :: Python :: 2.7
26-
Programming Language :: Python :: 3
27-
Programming Language :: Python :: 3.5
28-
Programming Language :: Python :: 3.6
29-
Programming Language :: Python :: 3.7
30-
Programming Language :: Python :: 3.8
31-
Programming Language :: Python :: 3.9
32-
Programming Language :: Python :: 3.10
33-
Programming Language :: Python :: 3.11
34-
Programming Language :: Python :: Implementation :: CPython
35-
Programming Language :: Python :: Implementation :: PyPy
36-
Topic :: Database
37-
Topic :: Software Development :: Libraries :: Python Modules
38-
Operating System :: Microsoft :: Windows
39-
Operating System :: Unix
40-
Framework :: ZODB
41-
"""
18+
version = '6.0.dev0'
4219

4320

4421
def read(path):
@@ -50,7 +27,6 @@ def read(path):
5027

5128
tests_require = [
5229
'manuel',
53-
'mock; python_version == "2.7"',
5430
'zope.testing',
5531
'zope.testrunner >= 4.4.6',
5632
]
@@ -61,14 +37,31 @@ def read(path):
6137
author="Jim Fulton",
6238
author_email="[email protected]",
6339
maintainer="Zope Foundation and Contributors",
64-
maintainer_email="zodb-dev@zope.org",
40+
maintainer_email="zodb-dev@zope.dev",
6541
keywords="database nosql python zope",
6642
packages=find_packages('src'),
6743
package_dir={'': 'src'},
6844
url='http://zodb-docs.readthedocs.io',
6945
license="ZPL 2.1",
7046
platforms=["any"],
71-
classifiers=list(filter(None, classifiers.split("\n"))),
47+
classifiers=[
48+
"Intended Audience :: Developers",
49+
"License :: OSI Approved :: Zope Public License",
50+
"Programming Language :: Python",
51+
"Programming Language :: Python :: 3",
52+
"Programming Language :: Python :: 3.7",
53+
"Programming Language :: Python :: 3.8",
54+
"Programming Language :: Python :: 3.9",
55+
"Programming Language :: Python :: 3.10",
56+
"Programming Language :: Python :: 3.11",
57+
"Programming Language :: Python :: Implementation :: CPython",
58+
"Programming Language :: Python :: Implementation :: PyPy",
59+
"Topic :: Database",
60+
"Topic :: Software Development :: Libraries :: Python Modules",
61+
"Operating System :: Microsoft :: Windows",
62+
"Operating System :: Unix",
63+
"Framework :: ZODB",
64+
],
7265
description=long_description.split('\n', 2)[1],
7366
long_description=long_description,
7467
tests_require=tests_require,
@@ -87,7 +80,6 @@ def read(path):
8780
'BTrees >= 4.2.0',
8881
'ZConfig',
8982
'transaction >= 2.4',
90-
'six',
9183
'zc.lockfile',
9284
'zope.interface',
9385
'zodbpickle >= 1.0.1',
@@ -102,5 +94,5 @@ def read(path):
10294
repozo = ZODB.scripts.repozo:main
10395
""",
10496
include_package_data=True,
105-
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*',
97+
python_requires='>=3.7',
10698
)

src/ZODB/ActivityMonitor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from . import utils
2020

2121

22-
class ActivityMonitor(object):
22+
class ActivityMonitor:
2323
"""ZODB load/store activity monitor
2424
2525
This simple implementation just keeps a small log in memory

src/ZODB/BaseStorage.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
The base class here is tightly coupled with its subclasses and
1717
its use is not recommended. It's still here for historical reasons.
1818
"""
19-
from __future__ import print_function
2019

2120
import logging
2221
import time
@@ -30,7 +29,6 @@
3029

3130
from . import POSException
3231
from . import utils
33-
from ._compat import py2_hasattr
3432
from .Connection import TransactionMetaData
3533
from .UndoLogCompatible import UndoLogCompatible
3634
from .utils import byte_chr
@@ -310,7 +308,12 @@ def copy(source, dest, verbose=0):
310308
# using store(). However, if we use store, then
311309
# copyTransactionsFrom() may fail with VersionLockError or
312310
# ConflictError.
313-
restoring = py2_hasattr(dest, 'restore')
311+
try:
312+
getattr(dest, 'restore')
313+
except: # noqa: E722 do not use bare 'except'
314+
restoring = False
315+
else:
316+
restoring = True
314317
fiter = source.iterator()
315318
for transaction in fiter:
316319
tid = transaction.tid
@@ -320,14 +323,14 @@ def copy(source, dest, verbose=0):
320323
t = TimeStamp(tid)
321324
if t <= _ts:
322325
if ok:
323-
print(('Time stamps out of order %s, %s' % (_ts, t)))
326+
print('Time stamps out of order {}, {}'.format(_ts, t))
324327
ok = 0
325328
_ts = t.laterThan(_ts)
326329
tid = _ts.raw()
327330
else:
328331
_ts = t
329332
if not ok:
330-
print(('Time stamps back in order %s' % (t)))
333+
print('Time stamps back in order %s' % (t))
331334
ok = 1
332335

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

377380

378381
@zope.interface.implementer(ZODB.interfaces.IStorageRecordInformation)
379-
class DataRecord(object):
382+
class DataRecord:
380383
"""Abstract base class for iterator protocol"""
381384

382385
version = ''

src/ZODB/ConflictResolution.py

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,11 @@
1313
##############################################################################
1414

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

21-
import six
22-
2319
import zope.interface
2420

25-
from ZODB._compat import BytesIO
2621
from ZODB._compat import PersistentPickler
2722
from ZODB._compat import PersistentUnpickler
2823
from ZODB._compat import _protocol
@@ -37,7 +32,7 @@ class BadClassName(Exception):
3732
pass
3833

3934

40-
class BadClass(object):
35+
class BadClass:
4136

4237
def __init__(self, *args):
4338
self.args = args
@@ -68,8 +63,8 @@ def find_global(*args):
6863
if cls == 1:
6964
# Not importable
7065
if (isinstance(args, tuple) and len(args) == 2 and
71-
isinstance(args[0], six.string_types) and
72-
isinstance(args[1], six.string_types)):
66+
isinstance(args[0], str) and
67+
isinstance(args[1], str)):
7368
return BadClass(*args)
7469
else:
7570
raise BadClassName(*args)
@@ -125,7 +120,7 @@ class may have its own comparison, and we have no idea what it is.
125120

126121

127122
@zope.interface.implementer(IPersistentReference)
128-
class PersistentReference(object):
123+
class PersistentReference:
129124

130125
weak = False
131126
oid = database_name = klass = None
@@ -169,7 +164,7 @@ def __init__(self, data):
169164
self.weak = True
170165
if not isinstance(self.oid, (bytes, type(None))):
171166
assert isinstance(self.oid, str)
172-
# this happens on Python 3 when all bytes in the oid are < 0x80
167+
# this happens when all bytes in the oid are < 0x80
173168
self.oid = self.oid.encode('ascii')
174169

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

188-
# Python 3 dropped __cmp__
189-
190183
def __eq__(self, other):
191184
return self.__cmp__(other) == 0
192185

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

208201
def __repr__(self):
209-
return "PR(%s %s)" % (id(self), self.data)
202+
return "PR({} {})".format(id(self), self.data)
210203

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

223216

224-
class PersistentReferenceFactory(object):
217+
class PersistentReferenceFactory:
225218

226219
data = None
227220

@@ -311,7 +304,7 @@ def tryToResolveConflict(self, oid, committedSerial, oldSerial, newpickle,
311304
data=newpickle)
312305

313306

314-
class ConflictResolvingStorage(object):
307+
class ConflictResolvingStorage:
315308
"Mix-in class that provides conflict resolution handling for storages"
316309

317310
tryToResolveConflict = tryToResolveConflict
@@ -323,7 +316,7 @@ def registerDB(self, wrapper):
323316
self._crs_untransform_record_data = wrapper.untransform_record_data
324317
self._crs_transform_record_data = wrapper.transform_record_data
325318
try:
326-
m = super(ConflictResolvingStorage, self).registerDB
319+
m = super().registerDB
327320
except AttributeError:
328321
pass
329322
else:

0 commit comments

Comments
 (0)