Skip to content

Commit

Permalink
Config with pure python template (#5)
Browse files Browse the repository at this point in the history
* Drop support for Python 2.7, 3.5, 3.6.
* Add support for Python 3.10, 3.11.
  • Loading branch information
Michael Howitz committed Dec 28, 2022
1 parent 9a5a5fb commit f0025d8
Show file tree
Hide file tree
Showing 13 changed files with 94 additions and 54 deletions.
25 changes: 12 additions & 13 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,29 @@ jobs:
fail-fast: false
matrix:
os:
- ubuntu
- ["ubuntu", "ubuntu-20.04"]
config:
# [Python version, tox env]
- ["3.8", "lint"]
- ["2.7", "py27"]
- ["3.5", "py35"]
- ["3.6", "py36"]
- ["3.9", "lint"]
- ["3.7", "py37"]
- ["3.8", "py38"]
- ["3.9", "py39"]
- ["pypy2", "pypy"]
- ["pypy3", "pypy3"]
- ["3.8", "coverage"]
- ["3.10", "py310"]
- ["3.11", "py311"]
- ["pypy-3.7", "pypy3"]
- ["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 All @@ -56,7 +55,7 @@ jobs:
- name: Coverage
if: matrix.config[1] == 'coverage'
run: |
pip install coveralls coverage-python-version
pip install coveralls
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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/
4 changes: 2 additions & 2 deletions .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
[meta]
template = "pure-python"
commit-id = "d3627ba9bcb25d0c7cb09b96d695040a20e0ab2b"
commit-id = "b2749126"

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

[coverage]
fail-under = 100
Expand Down
6 changes: 3 additions & 3 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Changelog
=========

0.4 (unreleased)
1.0 (unreleased)
----------------

- Add support for Python 3.7, 3.8 and 3.9.
- Drop support for Python 2.7, 3.4, 3.5, 3.6.

- Drop support for Python 3.4.
- Add support for Python 3.7, 3.8, 3.9, 3.10, 3.11.


0.3 (2017-07-13)
Expand Down
23 changes: 23 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!--
Generated from:
https://github.com/zopefoundation/meta/tree/master/config/pure-python
-->
# Contributing to zopefoundation projects

The projects under the zopefoundation GitHub organization are open source and
welcome contributions in different forms:

* bug reports
* code improvements and bug fixes
* documentation improvements
* pull request reviews

For any changes in the repository besides trivial typo fixes you are required
to sign the contributor agreement. See
https://www.zope.dev/developer/becoming-a-committer.html for details.

Please visit our [Developer
Guidelines](https://www.zope.dev/developer/guidelines.html) if you'd like to
contribute code changes and our [guidelines for reporting
bugs](https://www.zope.dev/developer/reporting-bugs.html) if you want to file a
bug report.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
include *.md
include *.rst
include *.txt
include buildout.cfg
Expand Down
13 changes: 12 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
[bdist_wheel]
universal = 1
universal = 0

[flake8]
doctests = 1
Expand All @@ -10,3 +10,14 @@ doctests = 1
ignore =
.editorconfig
.meta.toml

[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
14 changes: 7 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from setuptools import setup, find_packages
from setuptools import find_packages
from setuptools import setup

version = '0.4.dev0'

version = '1.0.dev0'


def read(name):
with open(name, 'r') as f:
with open(name) as f:
return f.read()


Expand All @@ -30,14 +32,12 @@ def read(name):
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"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",
"Framework :: Zope :: 3",
Expand Down
3 changes: 1 addition & 2 deletions src/zope/schemaevent/fieldevent.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
import zope.schema
import zope.component
import zope.schema


@zope.component.adapter(zope.schema.interfaces.IFieldEvent)
Expand Down
4 changes: 2 additions & 2 deletions src/zope/schemaevent/testing.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import zope.schemaevent
from zope.component.testlayer import ZCMLFileLayer

import zope.schemaevent


ZC_LAYER = ZCMLFileLayer(zope.schemaevent,
zcml_file='configure.zcml')
1 change: 0 additions & 1 deletion src/zope/schemaevent/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
# -*- coding: utf-8 -*-
20 changes: 10 additions & 10 deletions src/zope/schemaevent/tests/test_fieldevent.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import unittest
from zope import interface

from zope import component
from zope import interface
from zope import schema
from zope.schemaevent.testing import ZC_LAYER

Expand All @@ -20,13 +20,13 @@ def test_subscriber(self):
from zope.schema import Text
field = Text(
__name__='testing',
description=u'DESCRIPTION',
default=u'DEFAULT',
description='DESCRIPTION',
default='DEFAULT',
required=True,
)
prop = self._makeOne(field=field)

class Foo(object):
class Foo:
testing = prop
foo = Foo()

Expand All @@ -39,7 +39,7 @@ def add_field_event(event):
component.provideHandler(add_field_event)

self.assertEqual(len(logs), 0)
foo.testing = u'Bla'
foo.testing = 'Bla'
self.assertEqual(len(logs), 1)
event = logs[0]
self.assertEqual(event.field, field)
Expand All @@ -49,8 +49,8 @@ def test_filtered_handler(self):
from zope.schema import Text
field = Text(
__name__='testing',
description=u'DESCRIPTION',
default=u'DEFAULT',
description='DESCRIPTION',
default='DEFAULT',
required=True,
)
prop = self._makeOne(field=field)
Expand All @@ -60,7 +60,7 @@ class IFoo(interface.Interface):
"""

@interface.implementer(IFoo)
class Foo(object):
class Foo:
testing = prop
foo = Foo()

Expand All @@ -74,7 +74,7 @@ def add_field_events(obj, field, event):
component.provideHandler(add_field_events)

self.assertEqual(len(logs), 0)
foo.testing = u'Bla'
foo.testing = 'Bla'
self.assertEqual(len(logs), 1)
event_inst, event_field, _event = logs[0]
self.assertEqual(event_inst, foo)
Expand Down
33 changes: 20 additions & 13 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
minversion = 3.18
envlist =
lint
py27
py35
py36
py37
py38
py39
pypy
py310
py311
pypy3
coverage

Expand All @@ -25,32 +23,41 @@ extras =
[testenv:lint]
basepython = python3
skip_install = true
deps =
flake8
check-manifest
check-python-versions
wheel
commands =
isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py
flake8 src setup.py
check-manifest
check-python-versions
deps =
check-manifest
check-python-versions >= 0.19.1
wheel
flake8
isort

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

[testenv:coverage]
basepython = python3
allowlist_externals =
mkdir
deps =
coverage
coverage-python-version
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
plugins = coverage_python_version
source = zope.schemaevent

[coverage:report]
Expand Down

0 comments on commit f0025d8

Please sign in to comment.