Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support of Python 3.7 #217

Merged
merged 5 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 3 additions & 33 deletions config/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ updated. Example:

[tox]
additional-envlist = [
"py37-slim",
"py38-fat",
"py311-slim",
"py312-fat",
]
testenv-additional-extras = [
"extra-feature",
Expand Down Expand Up @@ -250,7 +250,7 @@ updated. Example:
"COVERAGE_HOME={toxinidir}",
]
coverage-additional = [
"depends = py37,docs",
"depends = py312,docs",
]
docs-deps = [
"urllib3 < 2",
Expand Down Expand Up @@ -715,33 +715,3 @@ Usage
To run the script just call it::

$ bin/python re-enable-actions.py

Dropping support for legacy Python versions
-------------------------------------------

To drop support for Python 2.7 up to 3.6 several steps have to be done as
documented at https://zope.dev/developer/python2.html#how-to-drop-support.
There is a script to ease this process.

Preparation
+++++++++++

* The package to remove legacy python support from has to have a ``.meta.toml``
file aka it must be under control of the ``config-package.py`` script.

Usage
+++++

To run the script call::

$ bin/python drop-legacy-python.py <path-to-package>

Additional optional parameters, see above at ``config-package.py`` for a
descriptions of them:

* ``--branch``

You can call the script interactively by passing the argument
``--interactive``, this will let the various scripts prompt for information and
prevent automatic commits and pushes. That way all changes can be viewed before
committing them.
2 changes: 0 additions & 2 deletions config/c-code/manylinux-install.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ tox_env_map() {
{% if with_future_python %}
*"cp313"*) echo 'py313';;
{% endif %}
*"cp37"*) echo 'py37';;
*"cp38"*) echo 'py38';;
*"cp39"*) echo 'py39';;
*"cp310"*) echo 'py310';;
Expand All @@ -50,7 +49,6 @@ for PYBIN in /opt/python/*/bin; do
{% endif %}
[[ "${PYBIN}" == *"cp311/"* ]] || \
[[ "${PYBIN}" == *"cp312/"* ]] || \
[[ "${PYBIN}" == *"cp37/"* ]] || \
[[ "${PYBIN}" == *"cp38/"* ]] || \
[[ "${PYBIN}" == *"cp39/"* ]] || \
[[ "${PYBIN}" == *"cp310/"* ]] ; then
Expand Down
8 changes: 2 additions & 6 deletions config/c-code/tests-strategy.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
{% if with_pypy %}
- "pypy-%(pypy_version)s"
{% endif %}
- "3.7"
- "3.8"
- "3.9"
- "3.10"
Expand All @@ -19,16 +18,13 @@
{% else %}
os: [ubuntu-latest, macos-latest]
{% endif %}
{% if with_pypy or gha_additional_exclude %}
exclude:
- os: macos-latest
python-version: "3.7"
{% endif %}
{% if with_pypy %}
- os: macos-latest
python-version: "pypy-%(pypy_version)s"
{% endif %}
{% for line in gha_additional_exclude %}
%(line)s
{% endfor %}
include:
- python-version: "3.7"
os: macos-12
27 changes: 9 additions & 18 deletions config/c-code/tests.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -123,39 +123,33 @@ jobs:
{% endfor %}
{% endif %}

{% for kind in ('macOS x86_64, Python 3.8+',
'macOS arm64, Python 3.8+',
'all other versions') %}
{% for kind in ('macOS x86_64', 'macOS arm64', 'all other versions') %}
- name: Build %(package_name)s (%(kind)s)
if: >
{% if kind == 'macOS x86_64, Python 3.8+' %}
{% if kind == 'macOS x86_64' %}
startsWith(runner.os, 'Mac')
&& !(startsWith(matrix.python-version, 'pypy')
|| matrix.python-version == '3.7')
&& !startsWith(matrix.python-version, 'pypy')
env:
MACOSX_DEPLOYMENT_TARGET: 10.9
_PYTHON_HOST_PLATFORM: macosx-10.9-x86_64
ARCHFLAGS: -arch x86_64
{% elif kind == 'macOS arm64, Python 3.8+' %}
{% elif kind == 'macOS arm64' %}
startsWith(runner.os, 'Mac')
&& !(startsWith(matrix.python-version, 'pypy')
|| matrix.python-version == '3.7')
&& !startsWith(matrix.python-version, 'pypy')
env:
MACOSX_DEPLOYMENT_TARGET: 11.0
_PYTHON_HOST_PLATFORM: macosx-11.0-arm64
ARCHFLAGS: -arch arm64
{% elif kind == 'macOS universal2, Python 3.8+' %}
{% elif kind == 'macOS universal2' %}
startsWith(runner.os, 'Mac')
&& !(startsWith(matrix.python-version, 'pypy')
|| matrix.python-version == '3.7')
&& !startsWith(matrix.python-version, 'pypy')
env:
MACOSX_DEPLOYMENT_TARGET: 10.9
_PYTHON_HOST_PLATFORM: macosx-10.9-universal2
ARCHFLAGS: -arch arm64 -arch x86_64
{% else %}
!startsWith(runner.os, 'Mac')
|| startsWith(matrix.python-version, 'pypy')
|| matrix.python-version == '3.7'
{% endif %}
run: |
# Next, build the wheel *in place*. This helps ccache, and also lets us cache the configure
Expand Down Expand Up @@ -185,17 +179,14 @@ jobs:
run: |
ls -l dist
twine check dist/*
{% for kind in ('macOS x86_64',
'macOS arm64',
'all other platforms') %}
{% for kind in ('macOS x86_64', 'macOS arm64', 'all other platforms') %}
- name: Upload %(package_name)s wheel (%(kind)s)
if: >
{% if kind == 'macOS x86_64' %}
startsWith(runner.os, 'Mac')
{% elif kind == 'macOS arm64' or kind == 'macOS universal2' %}
startsWith(runner.os, 'Mac')
&& !(startsWith(matrix.python-version, 'pypy')
|| matrix.python-version == '3.7')
&& !startsWith(matrix.python-version, 'pypy')
{% else %}
!startsWith(runner.os, 'Mac')
{% endif %}
Expand Down
1 change: 0 additions & 1 deletion config/c-code/tox.ini.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
minversion = 4.0
envlist =
lint
py37,py37-pure
py38,py38-pure
py39,py39-pure
py310,py310-pure
Expand Down
1 change: 0 additions & 1 deletion config/default/tests.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ jobs:
# [Python version, tox env]
- ["3.9", "release-check"]
- ["3.9", "lint"]
- ["3.7", "py37"]
- ["3.8", "py38"]
- ["3.9", "py39"]
- ["3.10", "py310"]
Expand Down
1 change: 0 additions & 1 deletion config/default/tox-envlist.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ minversion = 3.18
envlist =
release-check
lint
py37
py38
py39
py310
Expand Down
16 changes: 8 additions & 8 deletions config/drop-legacy-python.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


parser = argparse.ArgumentParser(
description='Drop support of Python 2.7 up to 3.6 from a package.')
description='Drop support of Python 2.7 up to 3.7 from a package.')
parser.add_argument(
'path', type=pathlib.Path, help='path to the repository to be configured')
parser.add_argument(
Expand Down Expand Up @@ -65,13 +65,13 @@
if not args.interactive:
call(bin_dir / 'bumpversion', '--breaking', '--no-input')
call(bin_dir / 'addchangelogentry',
'Drop support for Python 2.7, 3.5, 3.6.', '--no-input')
'Drop support for Python 2.7, 3.5, 3.6., 3.7.', '--no-input')
else:
call(bin_dir / 'bumpversion', '--breaking')
call(bin_dir / 'addchangelogentry',
'Drop support for Python 2.7, 3.5, 3.6.')
'Drop support for Python 2.7, 3.5, 3.6., 3.7.')
call(bin_dir / 'check-python-versions',
'--drop=2.7,3.5,3.6', '--only=setup.py')
'--drop=2.7,3.5,3.6,3.7', '--only=setup.py')
print('Remove legacy Python specific settings from .meta.toml')
call(os.environ['EDITOR'], '.meta.toml')

Expand All @@ -89,8 +89,8 @@
call(os.environ['EDITOR'], 'setup.py')
src = path.resolve() / 'src'
call('find', src, '-name', '*.py', '-exec',
bin_dir / 'pyupgrade', '--py3-plus', '--py37-plus', '{}', ';')
call(bin_dir / 'pyupgrade', '--py3-plus', '--py37-plus', 'setup.py',
bin_dir / 'pyupgrade', '--py3-plus', '--py38-plus', '{}', ';')
call(bin_dir / 'pyupgrade', '--py3-plus', '--py38-plus', 'setup.py',
allowed_return_codes=(0, 1))

excludes = ('--exclude-dir', '__pycache__', '--exclude-dir', '*.egg-info',
Expand All @@ -101,7 +101,7 @@
wait_for_accept()
print('Replace any remaining code that may support legacy Python 2:')
call('egrep', '-rn',
'2.7|3.5|3.6|sys.version|PY2|PY3|Py2|Py3|Python 2|Python 3'
'2.7|3.5|3.6|3.7|sys.version|PY2|PY3|Py2|Py3|Python 2|Python 3'
'|__unicode__|ImportError', src, *excludes,
allowed_return_codes=(0, 1))
wait_for_accept()
Expand All @@ -110,7 +110,7 @@
if not args.interactive:
print('Adding, committing and pushing all changes ...')
call('git', 'add', '.')
call('git', 'commit', '-m', 'Drop support for Python 2.7 up to 3.6.')
call('git', 'commit', '-m', 'Drop support for Python 2.7 up to 3.7.')
call('git', 'push', '--set-upstream', 'origin', branch_name)
if updating:
print('Updated the previously created PR.')
Expand Down
2 changes: 1 addition & 1 deletion config/shared/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
TYPES = ['buildout-recipe', 'c-code', 'pure-python', 'zope-product', 'toolkit']
ORG = 'zopefoundation'
BASE_PATH = pathlib.Path(__file__).parent.parent
OLDEST_PYTHON_VERSION = '3.7'
OLDEST_PYTHON_VERSION = '3.8'
NEWEST_PYTHON_VERSION = '3.12'
FUTURE_PYTHON_VERSION = '3.13'
PYPY_VERSION = '3.10'
Expand Down