Skip to content

Commit

Permalink
Fix GHA: ubuntu-latest no longer contains Python 2.7 up to 3.6 (#11)
Browse files Browse the repository at this point in the history
* Add support for Python 3.11.
* Isort imports.
  • Loading branch information
Michael Howitz committed Dec 14, 2022
1 parent 1d4e486 commit f3e4849
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 21 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fail-fast: false
matrix:
os:
- ubuntu
- ["ubuntu", "ubuntu-20.04"]
config:
# [Python version, tox env]
- ["3.9", "lint"]
Expand All @@ -28,21 +28,23 @@ jobs:
- ["3.8", "py38"]
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["pypy2", "pypy"]
- ["3.11", "py311"]
- ["pypy-2.7", "pypy"]
- ["pypy-3.7", "pypy3"]
- ["3.9", "docs"]
- ["3.9", "coverage"]

runs-on: ${{ matrix.os }}-latest
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.config[1] }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.config[0] }}
- name: Pip cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.config[0] }}-${{ hashFiles('setup.*', 'tox.ini') }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ lib64
log/
parts/
pyvenv.cfg
testing.log
var/
3 changes: 2 additions & 1 deletion .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
[meta]
template = "pure-python"
commit-id = "15807bd13de45b79c7da560a377fe3f22cbc4338"
commit-id = "200573eb414d2228d463da3de7d71a6d6335a704"

[python]
with-windows = false
Expand All @@ -11,6 +11,7 @@ with-future-python = false
with-legacy-python = true
with-docs = true
with-sphinx-doctests = false
with-macos = false

[tox]
use-flake8 = true
Expand Down
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
4.5 (unreleased)
================

- Nothing changed yet.
- Add support for Python 3.11.


4.4 (2022-03-17)
Expand Down
11 changes: 11 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,14 @@ ignore =
.editorconfig
.meta.toml
docs/_build/html/_sources/*

[isort]
force_single_line = True
combine_as_imports = True
sections = FUTURE,STDLIB,THIRDPARTY,ZOPE,FIRSTPARTY,LOCALFOLDER
known_third_party = six, docutils, pkg_resources
known_zope =
known_first_party =
default_section = ZOPE
line_length = 79
lines_after_imports = 2
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
"""Setup for zope.principalannotation package
"""
import os
from setuptools import setup, find_packages

from setuptools import find_packages
from setuptools import setup


def read(*rnames):
Expand Down Expand Up @@ -56,6 +58,7 @@ def read(*rnames):
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Natural Language :: English',
Expand Down
6 changes: 3 additions & 3 deletions src/zope/principalannotation/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
import doctest
import unittest

from zope.site.testing import siteSetUp, siteTearDown
from zope.configuration import xmlconfig

import zope.principalannotation
from zope.configuration import xmlconfig
from zope.site.testing import siteSetUp
from zope.site.testing import siteTearDown


def setUp(test):
Expand Down
8 changes: 5 additions & 3 deletions src/zope/principalannotation/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@
from BTrees.OOBTree import OOBTree
from persistent import Persistent
from persistent.dict import PersistentDict
from zope import interface, component

from zope import component
from zope import interface
from zope.annotation.interfaces import IAnnotations
from zope.component import queryNextUtility
from zope.location import Location
from zope.location.interfaces import IContained
from zope.principalannotation.interfaces import IPrincipalAnnotationUtility
from zope.security.interfaces import IPrincipal
from zope.component import queryNextUtility

from zope.principalannotation.interfaces import IPrincipalAnnotationUtility

# TODO: register utility as adapter for IAnnotations on utility activation.

Expand Down
24 changes: 18 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ envlist =
py38
py39
py310
py311
pypy
pypy3
docs
Expand All @@ -27,15 +28,26 @@ extras =
[testenv:lint]
basepython = python3
skip_install = true
commands =
isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py
flake8 src setup.py
check-manifest
check-python-versions
deps =
flake8
check-manifest
check-python-versions >= 0.19.1
wheel
flake8
isort

[testenv:isort-apply]
basepython = python3
skip_install = true
commands_pre =
deps =
isort
commands =
flake8 src setup.py
check-manifest
check-python-versions
isort {toxinidir}/src {toxinidir}/setup.py []

[testenv:docs]
basepython = python3
Expand All @@ -56,8 +68,8 @@ deps =
commands =
mkdir -p {toxinidir}/parts/htmlcov
coverage run -m zope.testrunner --test-path=src {posargs:-vc}
coverage html
coverage report -m --fail-under=100
coverage html --ignore-errors
coverage report --ignore-errors --show-missing --fail-under=100

[coverage:run]
branch = True
Expand Down

0 comments on commit f3e4849

Please sign in to comment.