Skip to content

Commit

Permalink
Config with pure python (#14)
Browse files Browse the repository at this point in the history
* Fix GHA: ubuntu-latest no longer contains Python 3.5 and 3.6
* Add support for Python 3.11.
* isort imports.
  • Loading branch information
Michael Howitz committed Dec 16, 2022
1 parent 84cab2e commit 48609dc
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 19 deletions.
12 changes: 7 additions & 5 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"]
- ["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 = "efa4b7532073de2e151785892b48ac95bc72981b"
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 @@
5.0.1 (unreleased)
==================

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


5.0.0 (2022-03-25)
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 @@ -19,7 +19,9 @@
"""Setup for zope.keyreference 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 @@ -59,6 +61,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
3 changes: 2 additions & 1 deletion src/zope/keyreference/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
"""Key-reference interfaces
"""
import zope.interface
from zope.schema import DottedName
from zope.i18nmessageid import MessageFactory
from zope.schema import DottedName


_ = MessageFactory('zope')

Expand Down
4 changes: 2 additions & 2 deletions src/zope/keyreference/persistent.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
Provides an IKeyReference adapter for persistent objects.
"""
from ZODB.interfaces import IConnection
from ZODB.ConflictResolution import PersistentReference
import zope.interface
from ZODB.ConflictResolution import PersistentReference
from ZODB.interfaces import IConnection

import zope.keyreference.interfaces

Expand Down
3 changes: 2 additions & 1 deletion src/zope/keyreference/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
Testing components.
"""

import zope.interface
import zope.component
import zope.interface

import zope.keyreference.interfaces


Expand Down
3 changes: 2 additions & 1 deletion src/zope/keyreference/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""
import doctest
import unittest

from zope.testing import renormalizing


Expand Down Expand Up @@ -88,9 +89,9 @@ def makeOne(self, obj):
return KeyReferenceToPersistent(obj)

def test_multi_databases(self):
from ZODB.MappingStorage import DB
import transaction
from BTrees.OOBTree import OOBucket
from ZODB.MappingStorage import DB

databases = {}

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 48609dc

Please sign in to comment.