Skip to content

Commit

Permalink
- apply latest meta/config templates and drop Python 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
dataflake committed Aug 27, 2024
1 parent 8ecbd46 commit 1cba640
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 124 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/c-code
name: pre-commit

on:
pull_request:
push:
branches:
- master
# Allow to run this workflow manually from the Actions tab
workflow_dispatch:

env:
FORCE_COLOR: 1

jobs:
pre-commit:
name: linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- uses: pre-commit/[email protected]
with:
extra_args: --all-files --show-diff-on-failure
env:
PRE_COMMIT_COLOR: always
- uses: pre-commit-ci/[email protected]
if: always()
with:
msg: Apply pre-commit code formatting
116 changes: 16 additions & 100 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Original comment follows.
###
###
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# This workflow will install Python dependencies, run tests with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
###

Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
# other people to test/debug), the strategy is to divide the process
# into several different jobs. The first builds and saves the binary
# wheels. It has dependent jobs that download and install the wheel
# to run tests, build docs, and perform linting. Building the
# to run tests, and build docs. Building the
# manylinux wheels is an independent set of jobs.
#
# This division is time-saving for projects that take awhile to
Expand All @@ -97,7 +97,6 @@ jobs:
matrix:
python-version:
- "pypy-3.10"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
Expand All @@ -106,13 +105,8 @@ jobs:
- "3.13"
os: [ubuntu-latest, macos-latest, windows-latest]
exclude:
- os: macos-latest
python-version: "3.7"
- os: macos-latest
python-version: "pypy-3.10"
include:
- python-version: "3.7"
os: macos-12

steps:
- name: checkout
Expand Down Expand Up @@ -169,11 +163,10 @@ jobs:
pip install -U pip
pip install -U "setuptools<69" wheel twine
- name: Build ExtensionClass (macOS x86_64, Python 3.8+)
- name: Build ExtensionClass (macOS x86_64)
if: >
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
Expand All @@ -183,11 +176,10 @@ jobs:
# output (pip install uses a random temporary directory, making this difficult).
python setup.py build_ext -i
python setup.py bdist_wheel
- name: Build ExtensionClass (macOS arm64, Python 3.8+)
- name: Build ExtensionClass (macOS arm64)
if: >
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
Expand All @@ -201,7 +193,6 @@ jobs:
if: >
!startsWith(runner.os, 'Mac')
|| startsWith(matrix.python-version, 'pypy')
|| matrix.python-version == '3.7'
run: |
# Next, build the wheel *in place*. This helps ccache, and also lets us cache the configure
# output (pip install uses a random temporary directory, making this difficult).
Expand Down Expand Up @@ -230,19 +221,18 @@ jobs:
startsWith(runner.os, 'Mac')
uses: actions/upload-artifact@v4
with:
name: ExtensionClass-${{ runner.os }}-${{ matrix.python-version }}.whl
# The x86_64 wheel is uploaded with a different name just so it can be
# manually downloaded when desired. The wheel itself *cannot* be tested
# on the GHA runner, which uses arm64 architecture.
name: ExtensionClass-${{ runner.os }}-${{ matrix.python-version }}-x86_64.whl
path: dist/*x86_64.whl
- name: Upload ExtensionClass wheel (macOS arm64)
if: >
startsWith(runner.os, 'Mac')
&& !(startsWith(matrix.python-version, 'pypy')
|| matrix.python-version == '3.7')
&& !startsWith(matrix.python-version, 'pypy')
uses: actions/upload-artifact@v4
with:
# The arm64 wheel is uploaded with a different name just so it can be
# manually downloaded when desired. The wheel itself *cannot* be tested
# on the GHA runner, which uses x86_64 architecture.
name: ExtensionClass-${{ runner.os }}-${{ matrix.python-version }}-arm64.whl
name: ExtensionClass-${{ runner.os }}-${{ matrix.python-version }}.whl
path: dist/*arm64.whl
- name: Upload ExtensionClass wheel (all other platforms)
if: >
Expand Down Expand Up @@ -274,7 +264,6 @@ jobs:
matrix:
python-version:
- "pypy-3.10"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
Expand All @@ -283,13 +272,8 @@ jobs:
- "3.13"
os: [ubuntu-latest, macos-latest, windows-latest]
exclude:
- os: macos-latest
python-version: "3.7"
- os: macos-latest
python-version: "pypy-3.10"
include:
- python-version: "3.7"
os: macos-12

steps:
- name: checkout
Expand Down Expand Up @@ -340,7 +324,7 @@ jobs:
with:
name: ExtensionClass-${{ runner.os }}-${{ matrix.python-version }}.whl
path: dist/
- name: Install ExtensionClass 3.13 ${{ matrix.python-version }}
- name: Install ExtensionClass ${{ matrix.python-version }}
if: matrix.python-version == '3.13'
run: |
pip install -U wheel "setuptools<69"
Expand Down Expand Up @@ -395,83 +379,13 @@ jobs:
with:
parallel-finished: true

lint:
needs: build-package
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.9"]
os: [ubuntu-latest]

steps:
- name: checkout
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
###
# Caching.
# This actually *restores* a cache and schedules a cleanup action
# to save the cache. So it must come before the thing we want to use
# the cache.
###
- name: Get pip cache dir (default)
id: pip-cache-default
if: ${{ !startsWith(runner.os, 'Windows') }}
run: |
echo "dir=$(pip cache dir)" >>$GITHUB_OUTPUT
- name: Get pip cache dir (Windows)
id: pip-cache-windows
if: ${{ startsWith(runner.os, 'Windows') }}
run: |
echo "dir=$(pip cache dir)" >> $Env:GITHUB_OUTPUT
- name: pip cache (default)
uses: actions/cache@v4
if: ${{ !startsWith(runner.os, 'Windows') }}
with:
path: ${{ steps.pip-cache-default.outputs.dir }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-pip-
- name: pip cache (Windows)
uses: actions/cache@v4
if: ${{ startsWith(runner.os, 'Windows') }}
with:
path: ${{ steps.pip-cache-windows.outputs.dir }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-pip-
- name: Download ExtensionClass wheel
uses: actions/download-artifact@v4
with:
name: ExtensionClass-${{ runner.os }}-${{ matrix.python-version }}.whl
path: dist/
- name: Install ExtensionClass
run: |
pip install -U pip
pip install -U wheel
pip install -U `ls dist/ExtensionClass-*`[test]
- name: Lint
# We only need to do this on one version, and it should be Python 3, because
# pylint has stopped updating for Python 2.
# TODO: Pick a linter and configuration and make this step right.
run: |
pip install -U pylint
# python -m pylint --limit-inference-results=1 --rcfile=.pylintrc ExtensionClass -f parseable -r n
manylinux:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
# We use a regular Python matrix entry to share as much code as possible.
strategy:
matrix:
python-version: ["3.9"]
python-version: ["3.11"]
image: [manylinux2014_x86_64, manylinux2014_i686, manylinux2014_aarch64]

steps:
Expand Down Expand Up @@ -552,6 +466,8 @@ jobs:
name: manylinux_${{ matrix.image }}_wheels.zip
- name: Restore pip cache permissions
run: sudo chown -R $(whoami) ${{ steps.pip-cache-default.outputs.dir }}
- name: Prevent publishing wheels for unreleased Python versions
run: VER=$(echo '3.13' | tr -d .) && ls -al wheelhouse && sudo rm -f wheelhouse/*-cp${VER}*.whl && ls -al wheelhouse
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: >
Expand Down
2 changes: 0 additions & 2 deletions .manylinux-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ yum -y install libffi-devel
tox_env_map() {
case $1 in
*"cp313"*) echo 'py313';;
*"cp37"*) echo 'py37';;
*"cp38"*) echo 'py38';;
*"cp39"*) echo 'py39';;
*"cp310"*) echo 'py310';;
Expand All @@ -45,7 +44,6 @@ for PYBIN in /opt/python/*/bin; do
[[ "${PYBIN}" == *"cp313/"* ]] || \
[[ "${PYBIN}" == *"cp311/"* ]] || \
[[ "${PYBIN}" == *"cp312/"* ]] || \
[[ "${PYBIN}" == *"cp37/"* ]] || \
[[ "${PYBIN}" == *"cp38/"* ]] || \
[[ "${PYBIN}" == *"cp39/"* ]] || \
[[ "${PYBIN}" == *"cp310/"* ]] ; then
Expand Down
3 changes: 1 addition & 2 deletions .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
# https://github.com/zopefoundation/meta/tree/master/config/c-code
[meta]
template = "c-code"
commit-id = "4dc0484e"
commit-id = "4eec7859"

[python]
with-appveyor = false
with-windows = true
with-pypy = true
with-sphinx-doctests = false
Expand Down
28 changes: 28 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/c-code
minimum_pre_commit_version: '3.6'
repos:
- repo: https://github.com/pycqa/isort
rev: "5.13.2"
hooks:
- id: isort
- repo: https://github.com/hhatto/autopep8
rev: "v2.3.1"
hooks:
- id: autopep8
args: [--in-place, --aggressive, --aggressive]
- repo: https://github.com/asottile/pyupgrade
rev: v3.17.0
hooks:
- id: pyupgrade
args: [--py38-plus]
- repo: https://github.com/isidentical/teyit
rev: 0.4.3
hooks:
- id: teyit
- repo: https://github.com/PyCQA/flake8
rev: "7.1.1"
hooks:
- id: flake8
additional_dependencies:
- flake8-debugger == 4.1.2
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
Changelog
===========

5.2 (unreleased)
6.0 (unreleased)
================

- Build Windows wheels on GHA.

- Add preliminary support for Python 3.13 as of 3.13b1.

- Drop support for Python 3.7.


5.1 (2023-10-05)
================
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ include *.rst
include *.txt
include buildout.cfg
include tox.ini
include .pre-commit-config.yaml
include .coveragerc

recursive-include src *.py
Expand Down
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
include_dirs=['src']),
]

version = '5.2.dev0'
version = '6.0.dev0'

setup(
name='ExtensionClass',
Expand All @@ -70,7 +70,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",
Expand All @@ -87,5 +86,5 @@
'zope.testrunner',
],
},
python_requires='>=3.7',
python_requires='>=3.8',
)
2 changes: 1 addition & 1 deletion src/ExtensionClass/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
def print_dict(d):
d = d.items()
print('{%s}' % (', '.join(
[('{!r}: {!r}'.format(k, v)) for (k, v) in sorted(d)]
[(f'{k!r}: {v!r}') for (k, v) in sorted(d)]
)))


Expand Down
Loading

0 comments on commit 1cba640

Please sign in to comment.