Skip to content

Commit

Permalink
Merge pull request #322 from zopefoundation/config-with-c-code-templa…
Browse files Browse the repository at this point in the history
…te-acd39fc2

Config with c code template acd39fc2
  • Loading branch information
dataflake authored Oct 10, 2024
2 parents d16f663 + 04c43de commit 02c8c61
Show file tree
Hide file tree
Showing 23 changed files with 754 additions and 683 deletions.
30 changes: 0 additions & 30 deletions .coveragerc

This file was deleted.

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
96 changes: 7 additions & 89 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 Down Expand Up @@ -152,16 +152,10 @@ jobs:
restore-keys: |
${{ runner.os }}-pip-
- name: Install Build Dependencies (3.13)
if: matrix.python-version == '3.13'
run: |
pip install -U pip
pip install -U "setuptools<69" wheel twine
- name: Install Build Dependencies
if: matrix.python-version != '3.13'
run: |
pip install -U pip
pip install -U "setuptools<69" wheel twine
pip install -U "setuptools <74" wheel twine
- name: Build zope.interface (macOS x86_64)
if: >
Expand Down Expand Up @@ -199,15 +193,7 @@ jobs:
python setup.py build_ext -i
python setup.py bdist_wheel
- name: Install zope.interface and dependencies (3.13)
if: matrix.python-version == '3.13'
run: |
# Install to collect dependencies into the (pip) cache.
# Use "--pre" here because dependencies with support for this future
# Python release may only be available as pre-releases
pip install --pre .[test]
- name: Install zope.interface and dependencies
if: matrix.python-version != '3.13'
run: |
# Install to collect dependencies into the (pip) cache.
pip install .[test]
Expand Down Expand Up @@ -250,7 +236,6 @@ jobs:
&& startsWith(github.ref, 'refs/tags')
&& !startsWith(runner.os, 'Linux')
&& !startsWith(matrix.python-version, 'pypy')
&& !startsWith(matrix.python-version, '3.13')
env:
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
run: |
Expand Down Expand Up @@ -331,7 +316,7 @@ jobs:
# works fine with non-editable installs.)
run: |
pip install -U wheel
pip install -U --no-binary :all: coverage
pip install -U --no-binary :all: coverage[toml]
# Unzip into src/ so that testrunner can find the .so files
# when we ask it to load tests from that directory. This
# might also save some build time?
Expand Down Expand Up @@ -371,7 +356,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.9"]
python-version: ["3.11"]
os: [ubuntu-latest]

steps:
Expand Down Expand Up @@ -426,7 +411,7 @@ jobs:
- name: Install zope.interface
run: |
pip install -U wheel
pip install -U coverage
pip install -U coverage[toml]
pip install -U "`ls dist/zope.interface-*.whl`[docs]"
- name: Build docs
env:
Expand All @@ -435,80 +420,13 @@ jobs:
sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html
sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctest
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 zope.interface wheel
uses: actions/download-artifact@v4
with:
name: zope.interface-${{ runner.os }}-${{ matrix.python-version }}.whl
path: dist/
- name: Install zope.interface
run: |
pip install -U pip
pip install -U wheel
pip install -U `ls dist/zope.interface-*`[test]
- name: Lint
run: |
pip install -U tox
tox -e lint
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
19 changes: 7 additions & 12 deletions .manylinux-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,27 @@ yum -y install libffi-devel

tox_env_map() {
case $1 in
*"cp313"*) echo 'py313';;
*"cp38"*) echo 'py38';;
*"cp39"*) echo 'py39';;
*"cp310"*) echo 'py310';;
*"cp311"*) echo 'py311';;
*"cp312"*) echo 'py312';;
*"cp313"*) echo 'py313';;
*) echo 'py';;
esac
}

# Compile wheels
for PYBIN in /opt/python/*/bin; do
if \
[[ "${PYBIN}" == *"cp313/"* ]] || \
[[ "${PYBIN}" == *"cp311/"* ]] || \
[[ "${PYBIN}" == *"cp312/"* ]] || \
[[ "${PYBIN}" == *"cp38/"* ]] || \
[[ "${PYBIN}" == *"cp39/"* ]] || \
[[ "${PYBIN}" == *"cp310/"* ]] ; then
if [[ "${PYBIN}" == *"cp313/"* ]] ; then
"${PYBIN}/pip" install --pre -e /io/
"${PYBIN}/pip" wheel /io/ --pre -w wheelhouse/
else
"${PYBIN}/pip" install -e /io/
"${PYBIN}/pip" wheel /io/ -w wheelhouse/
fi
[[ "${PYBIN}" == *"cp310/"* ]] || \
[[ "${PYBIN}" == *"cp311/"* ]] || \
[[ "${PYBIN}" == *"cp312/"* ]] || \
[[ "${PYBIN}" == *"cp313/"* ]] ; then
"${PYBIN}/pip" install -e /io/
"${PYBIN}/pip" wheel /io/ -w wheelhouse/
if [ `uname -m` == 'aarch64' ]; then
cd /io/
${PYBIN}/pip install tox
Expand Down
15 changes: 6 additions & 9 deletions .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,28 @@
# https://github.com/zopefoundation/meta/tree/master/config/c-code
[meta]
template = "c-code"
commit-id = "8d837c89"
commit-id = "85622de1"

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

[tox]
use-flake8 = true
testenv-commands = [
"pip install -U -e .[test]",
"coverage run -p -m unittest discover -s src {posargs}",
]
testenv-deps = [
"py37: urllib3 < 2",
]
testenv-setenv = [
"ZOPE_INTERFACE_STRICT_IRO=1",
]
coverage-command = "coverage combine"
coverage-additional = [
"depends = py37,py37-pure,py38,py38-pure,py39,py39-pure,py310,py310-pure,py311,py311-pure,pypy,pypy3,docs",
"depends = py38,py38-pure,py39,py39-pure,py310,py310-pure,py311,py311-pure,py312,py312-pure,py313,py313-pure,pypy3,docs",
"parallel_show_output = true",
]

Expand All @@ -41,15 +39,14 @@ additional-config = [
]

[coverage]
fail-under = 99
fail-under = 98

[manifest]
additional-rules = [
"include *.yaml",
"include *.cmd",
"include *.sh",
"include *.yml",
"include .coveragerc",
"recursive-include benchmarks *.py",
"recursive-include docs *.bat",
"recursive-include docs *.py",
Expand All @@ -73,7 +70,7 @@ additional-install = [
" # works fine with non-editable installs.)",
" run: |",
" pip install -U wheel",
" pip install -U --no-binary :all: coverage",
" pip install -U --no-binary :all: coverage[toml]",
" # Unzip into src/ so that testrunner can find the .so files",
" # when we ask it to load tests from that directory. This",
" # might also save some build time?",
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
3 changes: 1 addition & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ include *.rst
include *.txt
include buildout.cfg
include tox.ini
include .coveragerc
include .pre-commit-config.yaml

recursive-include docs *.py
recursive-include docs *.rst
Expand All @@ -17,7 +17,6 @@ include *.yaml
include *.cmd
include *.sh
include *.yml
include .coveragerc
recursive-include benchmarks *.py
recursive-include docs *.bat
recursive-include docs *.py
Expand Down
Loading

0 comments on commit 02c8c61

Please sign in to comment.