Skip to content

Commit

Permalink
Config with pure python template (#6)
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.11.
  • Loading branch information
Michael Howitz committed Jan 14, 2023
1 parent 7d28e93 commit 948eb10
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 37 deletions.
17 changes: 7 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,29 @@ jobs:
fail-fast: false
matrix:
os:
- ubuntu
- ["ubuntu", "ubuntu-20.04"]
config:
# [Python version, tox env]
- ["3.9", "lint"]
- ["2.7", "py27"]
- ["3.5", "py35"]
- ["3.6", "py36"]
- ["3.7", "py37"]
- ["3.8", "py38"]
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["pypy-2.7", "pypy"]
- ["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 @@ -58,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 }}
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 = "ae61f414cfef4e129d275679c6a76dc67b1a2c11"
commit-id = "4f0f7596"

[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 = 99
Expand Down
8 changes: 5 additions & 3 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
CHANGES
=========

4.1.1 (unreleased)
==================
5.0 (unreleased)
================

- Add support for Python 3.11.

- Nothing changed yet.
- Drop support for Python 2.7, 3.5, 3.6.


4.1.0 (2022-08-05)
Expand Down
2 changes: 1 addition & 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 Down
8 changes: 3 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def read(*rnames):


setup(name='zope.app.preference',
version='4.1.1.dev0',
version='5.0.dev0',
author='Zope Foundation and Contributors',
author_email='zope-dev@zope.org',
description='User Preferences Framework ZMI UI',
Expand All @@ -50,15 +50,12 @@ def read(*rnames):
'Intended Audience :: Developers',
'License :: OSI Approved :: Zope Public License',
'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',
'Natural Language :: English',
Expand All @@ -71,6 +68,7 @@ def read(*rnames):
packages=find_packages('src'),
package_dir={'': 'src'},
namespace_packages=['zope', 'zope.app'],
python_requires='>=3.7',
extras_require={
'test': [
'docutils',
Expand Down
8 changes: 4 additions & 4 deletions src/zope/app/preference/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class PreferencesMacros(StandardMacros):


@zope.interface.implementer(IObjectFindFilter)
class PreferenceGroupFilter(object):
class PreferenceGroupFilter:
"""A special filter for preferences"""

def matches(self, obj):
Expand Down Expand Up @@ -84,8 +84,8 @@ def __init__(self, context, request):

name = translate(context.__title__, context=request,
default=context.__title__)
self.label = Message(pref_msg, mapping={u'name': name})
super(EditPreferenceGroup, self).__init__(context, request)
self.label = Message(pref_msg, mapping={'name': name})
super().__init__(context, request)
self.setPrefix(context.__id__)

def getIntroduction(self):
Expand All @@ -98,7 +98,7 @@ def getIntroduction(self):
text = re.sub('\n[ ]{%i}' % cols, '\n', text).strip()

if not text:
return u''
return ''

# Render the description as ReST.
source = zope.component.createObject('zope.source.rest', text)
Expand Down
8 changes: 4 additions & 4 deletions src/zope/app/preference/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Source(text_type):


@implementer(IFactory)
class SourceFactory(object):
class SourceFactory:
"""Creates an ISource object."""

def __init__(self, iface, title='', description=''):
Expand All @@ -68,8 +68,8 @@ def __call__(self, ustr):


ReStructuredTextSourceFactory = SourceFactory(
IReStructuredTextSource, u"ReStructured Text (ReST)",
u"ReStructured Text (ReST) Source")
IReStructuredTextSource, "ReStructured Text (ReST)",
"ReStructured Text (ReST) Source")


class _ReStructuredTextToHTMLRenderer(BrowserView):
Expand Down Expand Up @@ -142,7 +142,7 @@ def render(self, settings_overrides={}):
writer_name='html',
settings_overrides=overrides,
)
return u''.join(
return ''.join(
(parts['body_pre_docinfo'], parts['docinfo'], parts['body']))


Expand Down
12 changes: 4 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@
minversion = 3.18
envlist =
lint
py27
py35
py36
py37
py38
py39
py310
pypy
py311
pypy3
coverage

Expand Down Expand Up @@ -40,6 +37,7 @@ deps =

[testenv:isort-apply]
basepython = python3
skip_install = true
commands_pre =
deps =
isort
Expand All @@ -52,16 +50,14 @@ 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=99
coverage html --ignore-errors
coverage report --ignore-errors --show-missing --fail-under=99

[coverage:run]
branch = True
plugins = coverage_python_version
source = zope.app.preference

[coverage:report]
Expand Down

0 comments on commit 948eb10

Please sign in to comment.