Skip to content

Commit

Permalink
Config with pure python template (#9)
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.
* Fix security advisory by deleting no longer needed file.
  • Loading branch information
Michael Howitz committed Dec 29, 2022
1 parent f0884ec commit 6496691
Show file tree
Hide file tree
Showing 18 changed files with 115 additions and 89 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 = 97
Expand Down
8 changes: 6 additions & 2 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
Changes
=======

3.1.0 (unreleased)
------------------
4.0 (unreleased)
----------------

- Add support for Python 3.10, 3.11.

- Drop support for Python 2.7, 3.5, 3.6.

- Add support for Python 3.6, 3.7, 3.8 and 3.9.

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
27 changes: 0 additions & 27 deletions buildout.cfg

This file was deleted.

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 @@ -13,3 +13,14 @@ per-file-ignores =
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,12 +1,14 @@
import os
from setuptools import setup, find_packages

from setuptools import find_packages
from setuptools import setup


def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()


long_description = "%s\n%s\n" % (read('README.txt'), read('CHANGES.txt'))
long_description = "{}\n{}\n".format(read('README.txt'), read('CHANGES.txt'))
install_requires = [
'setuptools',
'persistent',
Expand All @@ -24,7 +26,7 @@ def read(*rnames):

setup(
name='grokcore.content',
version='3.1.0.dev0',
version='4.0.dev0',
author='Grok Team',
author_email='grok-dev@zope.org',
url='http://grok.zope.org',
Expand All @@ -47,14 +49,12 @@ def read(*rnames):
'Framework :: Zope :: 3',
'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',
],
Expand Down
7 changes: 1 addition & 6 deletions src/grokcore/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
__import__('pkg_resources').declare_namespace(__name__)
15 changes: 10 additions & 5 deletions src/grokcore/content/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
from grokcore.component.interfaces import IContext
from grokcore.content.interfaces import IContainer, IOrderedContainer
from grokcore.content.interfaces import IObjectEditedEvent, ObjectEditedEvent
from grokcore.content.components import Model, Container, OrderedContainer
from zope.container.interfaces import IContainerModifiedEvent
from zope.container.contained import ContainerModifiedEvent
from zope.lifecycleevent.interfaces import IObjectModifiedEvent
from zope.container.interfaces import IContainerModifiedEvent
from zope.lifecycleevent import ObjectModifiedEvent
from zope.lifecycleevent.interfaces import IObjectModifiedEvent

from grokcore.content.components import Container
from grokcore.content.components import Model
from grokcore.content.components import OrderedContainer
from grokcore.content.interfaces import IContainer
from grokcore.content.interfaces import IObjectEditedEvent
from grokcore.content.interfaces import IOrderedContainer
from grokcore.content.interfaces import ObjectEditedEvent
13 changes: 7 additions & 6 deletions src/grokcore/content/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
"""Base content components for Grok.
"""
import persistent

from grokcore.content import interfaces
from persistent.list import PersistentList
from zope.annotation.interfaces import IAttributeAnnotatable
from zope.container.btree import BTreeContainer
from zope.container.contained import Contained, notifyContainerModified
from zope.container.contained import Contained
from zope.container.contained import notifyContainerModified
from zope.interface import implementer

from grokcore.content import interfaces


@implementer(IAttributeAnnotatable, interfaces.IContext)
class Model(Contained, persistent.Persistent):
Expand Down Expand Up @@ -78,7 +79,7 @@ class OrderedContainer(Container):
"""

def __init__(self):
super(OrderedContainer, self).__init__()
super().__init__()
self._order = PersistentList()

def keys(self):
Expand All @@ -96,14 +97,14 @@ def items(self):

def __setitem__(self, key, object):
# Do whatever containers normally do.
super(OrderedContainer, self).__setitem__(key, object)
super().__setitem__(key, object)
# If the key was already in the container, a KeyError will be returned
# so we can safely add the key to self._order now.
self._order.append(key)

def __delitem__(self, key):
# First do whatever containers normally do.
super(OrderedContainer, self).__delitem__(key)
super().__delitem__(key)
self._order.remove(key)

def updateOrder(self, order):
Expand Down
6 changes: 3 additions & 3 deletions src/grokcore/content/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
##############################################################################
"""Specific content interfaces for Grok.
"""
import zope.interface
from grokcore.component.interfaces import IContext
from zope.container.interfaces import IOrderedContainer
from zope.container.interfaces import IContainer as IContainerBase
from zope.lifecycleevent.interfaces import IObjectModifiedEvent
from zope.container.interfaces import IOrderedContainer
from zope.lifecycleevent import ObjectModifiedEvent
import zope.interface
from zope.lifecycleevent.interfaces import IObjectModifiedEvent


class IContainer(IContext, IContainerBase):
Expand Down
3 changes: 2 additions & 1 deletion src/grokcore/content/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# make this directory a package
import unittest

import grokcore.content.tests.test_container
import grokcore.content.tests.test_container_event
import grokcore.content.tests.test_orderedcontainer
import grokcore.content.tests.test_verify_containers
import unittest


def collect_tests():
Expand Down
3 changes: 2 additions & 1 deletion src/grokcore/content/tests/test_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"""

from grokcore.content import Model, Container
from grokcore.content import Container
from grokcore.content import Model


class BoneBag(Container):
Expand Down
5 changes: 4 additions & 1 deletion src/grokcore/content/tests/test_container_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@
"""

from grokcore.component import subscribe
from grokcore.content import Model, OrderedContainer
from zope.container.interfaces import IContainerModifiedEvent

from grokcore.content import Model
from grokcore.content import OrderedContainer


class OrderedBones(OrderedContainer):
pass
Expand All @@ -46,6 +48,7 @@ def container_changed(object, event):

def test_suite():
import doctest

import zope.component.eventtesting
from zope.testing import cleanup

Expand Down
3 changes: 2 additions & 1 deletion src/grokcore/content/tests/test_orderedcontainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@
""" # noqa: E501 line too long

from grokcore.content import Model, OrderedContainer
from grokcore.content import Model
from grokcore.content import OrderedContainer


class OrderedBones(OrderedContainer):
Expand Down
Loading

0 comments on commit 6496691

Please sign in to comment.