From 5a0254155ca9504d0bcb9a1e326180c7f3327461 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Fri, 7 Jun 2024 11:18:34 +0200 Subject: [PATCH] Drop Python 3.7 support. (#64) --- .github/workflows/tests.yml | 30 +++++++++++++++++------------- .meta.toml | 3 ++- CHANGES.rst | 4 +++- setup.cfg | 2 -- setup.py | 5 ++--- src/DateTime/DateTime.py | 8 ++++---- tox.ini | 5 +++-- 7 files changed, 31 insertions(+), 26 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b446610..7058512 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,37 +17,37 @@ jobs: fail-fast: false matrix: os: - - ["ubuntu", "ubuntu-20.04"] + - ["ubuntu", "ubuntu-latest"] - ["windows", "windows-latest"] config: # [Python version, tox env] - - ["3.9", "release-check"] - - ["3.9", "lint"] - - ["3.7", "py37"] + - ["3.11", "release-check"] + - ["3.11", "lint"] - ["3.8", "py38"] - ["3.9", "py39"] - ["3.10", "py310"] - ["3.11", "py311"] - ["3.12", "py312"] - - ["3.13.0-alpha - 3.13.0", "py313"] - - ["pypy-3.9", "pypy3"] - - ["3.9", "coverage"] + - ["3.13", "py313"] + - ["pypy-3.10", "pypy3"] + - ["3.11", "coverage"] exclude: - - { os: ["windows", "windows-latest"], config: ["3.9", "release-check"] } - - { os: ["windows", "windows-latest"], config: ["3.9", "lint"] } - - { os: ["windows", "windows-latest"], config: ["3.9", "coverage"] } + - { os: ["windows", "windows-latest"], config: ["3.11", "release-check"] } + - { os: ["windows", "windows-latest"], config: ["3.11", "lint"] } + - { os: ["windows", "windows-latest"], config: ["3.11", "coverage"] } 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 name: ${{ matrix.os[0] }}-${{ matrix.config[1] }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.config[0] }} + allow-prereleases: true - name: Pip cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ matrix.config[0] }}-${{ hashFiles('setup.*', 'tox.ini') }} @@ -59,7 +59,11 @@ jobs: python -m pip install --upgrade pip pip install tox - name: Test + if: ${{ !startsWith(runner.os, 'Mac') }} run: tox -e ${{ matrix.config[1] }} + - name: Test (macOS) + if: ${{ startsWith(runner.os, 'Mac') }} + run: tox -e ${{ matrix.config[1] }}-universal2 - name: Coverage if: matrix.config[1] == 'coverage' run: | diff --git a/.meta.toml b/.meta.toml index 09fe25e..b23dd73 100644 --- a/.meta.toml +++ b/.meta.toml @@ -2,7 +2,7 @@ # https://github.com/zopefoundation/meta/tree/master/config/zope-product [meta] template = "zope-product" -commit-id = "8a08ecb4" +commit-id = "b1221c3c" [python] with-pypy = true @@ -10,6 +10,7 @@ with-sphinx-doctests = false with-windows = true with-future-python = true with-macos = false +with-docs = false [coverage] fail-under = 88 diff --git a/CHANGES.rst b/CHANGES.rst index 885e5eb..ea24078 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,9 +1,11 @@ Changelog ========= -5.6 (unreleased) +6.0 (unreleased) ---------------- +- Drop support for Python 3.7. + - Remove Python2 compatiblity code. diff --git a/setup.cfg b/setup.cfg index e244274..a7bfdb4 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,5 @@ # Generated from: # https://github.com/zopefoundation/meta/tree/master/config/zope-product -[bdist_wheel] -universal = 0 [flake8] doctests = 1 diff --git a/setup.py b/setup.py index 490cec4..aad8bd4 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ with open(os.path.join(here, 'CHANGES.rst')) as f: CHANGES = f.read() -version = '5.6.dev0' +version = '6.0.dev0' setup( name='DateTime', @@ -55,7 +55,6 @@ "Operating System :: OS Independent", "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", @@ -64,7 +63,7 @@ "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", ], - python_requires='>=3.7', + python_requires='>=3.8', install_requires=[ 'zope.interface', 'pytz', diff --git a/src/DateTime/DateTime.py b/src/DateTime/DateTime.py index 5278a47..2337722 100644 --- a/src/DateTime/DateTime.py +++ b/src/DateTime/DateTime.py @@ -439,7 +439,7 @@ def __init__(self, *args, **kw): except (DateError, TimeError, DateTimeError): raise except Exception: - raise SyntaxError('Unable to parse {}, {}'.format(args, kw)) + raise SyntaxError(f'Unable to parse {args}, {kw}') def __getstate__(self): return (self._micros, @@ -812,7 +812,7 @@ def _parse_args(self, *args, **kw): hr, mn, sc, tz = 0, 0, 0, 0 yr = _correctYear(yr) if not self._validDate(yr, mo, dy): - raise DateError('Invalid date: {}'.format(args)) + raise DateError(f'Invalid date: {args}') args = args[3:] if args: hr, args = args[0], args[1:] @@ -956,7 +956,7 @@ def _parse(self, st, datefmt=getDefaultDateFormat()): i = i + ls if (ls == 4 and d and d in '+-' and (len(ints) + (not not month) >= 3)): - tz = '{}{}'.format(d, s) + tz = f'{d}{s}' else: v = int(s) ints.append(v) @@ -1764,7 +1764,7 @@ def __repr__(self): """Convert a DateTime to a string that looks like a Python expression. """ - return '{}(\'{}\')'.format(self.__class__.__name__, str(self)) + return f'{self.__class__.__name__}(\'{str(self)}\')' def __str__(self): """Convert a DateTime to a string.""" diff --git a/tox.ini b/tox.ini index 5e5e071..26e66ed 100644 --- a/tox.ini +++ b/tox.ini @@ -5,7 +5,6 @@ minversion = 3.18 envlist = release-check lint - py37 py38 py39 py310 @@ -18,6 +17,7 @@ envlist = [testenv] skip_install = true deps = + setuptools < 69 zc.buildout >= 3.0.1 wheel > 0.37 setenv = @@ -41,7 +41,7 @@ deps = commands_pre = commands = check-manifest - check-python-versions + check-python-versions --only setup.py,tox.ini,.github/workflows/tests.yml python -m build --sdist --no-isolation twine check dist/* @@ -91,6 +91,7 @@ source = DateTime [coverage:report] precision = 2 +ignore_errors = True exclude_lines = pragma: no cover pragma: nocover