Skip to content

Commit

Permalink
Config with pure python template c62c2ff (#16)
Browse files Browse the repository at this point in the history
* Configuring for pure-python

* Lint the code.

* Bumped version for breaking release.

* Drop support for Python 2.7, 3.5, 3.6.

* Add support for Python 3.9, 3.10, 3.11.

* Fix badge.
Michael Howitz authored Feb 24, 2023
1 parent c62c2ff commit 870a6d6
Showing 41 changed files with 503 additions and 293 deletions.
8 changes: 0 additions & 8 deletions .coveragerc

This file was deleted.

39 changes: 39 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
#
# EditorConfig Configuration file, for more details see:
# http://EditorConfig.org
# EditorConfig is a convention description, that could be interpreted
# by multiple editors to enforce common coding conventions for specific
# file types

# top-most EditorConfig file:
# Will ignore other EditorConfig files in Home directory or upper tree level.
root = true


[*] # For All Files
# Unix-style newlines with a newline ending every file
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
# Set default charset
charset = utf-8
# Indent style default
indent_style = space
# Max Line Length - a hard line wrap, should be disabled
max_line_length = off

[*.{py,cfg,ini}]
# 4 space indentation
indent_size = 4

[*.{yml,zpt,pt,dtml,zcml}]
# 2 space indentation
indent_size = 2

[{Makefile,.gitmodules}]
# Tab indentation (no size specified, but view as 4 spaces)
indent_style = tab
indent_size = unset
tab_width = unset
61 changes: 61 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
name: tests

on:
push:
pull_request:
schedule:
- cron: '0 12 * * 0' # run once a week on Sunday
# Allow to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
strategy:
# We want to see all failures:
fail-fast: false
matrix:
os:
- ["ubuntu", "ubuntu-20.04"]
config:
# [Python version, tox env]
- ["3.9", "lint"]
- ["3.7", "py37"]
- ["3.8", "py38"]
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["3.11", "py311"]
- ["pypy-3.9", "pypy3"]
- ["3.9", "coverage"]

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@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.config[0] }}
- name: Pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.config[0] }}-${{ hashFiles('setup.*', 'tox.ini') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.config[0] }}-
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Test
run: tox -e ${{ matrix.config[1] }}
- name: Coverage
if: matrix.config[1] == 'coverage'
run: |
pip install coveralls
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26 changes: 22 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,32 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
*.dll
*.egg-info/
*.profraw
*.pyc
*.pyo
*.so
.coverage
.coverage.*
.eggs/
.installed.cfg
.tox
__pycache__
.mr.developer.cfg
.tox/
.vscode/
__pycache__/
bin/
build/
coverage.xml
develop-eggs/
develop/
dist/
docs/_build
eggs/
htmlcov/
etc/
lib/
lib64
log/
parts/
src/*.egg-info
pyvenv.cfg
testing.log
var/
24 changes: 24 additions & 0 deletions .meta.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
[meta]
template = "pure-python"
commit-id = "f6bd0f55"

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

[tox]
use-flake8 = true

[coverage]
fail-under = 99

[manifest]
additional-rules = [
"recursive-include src *.txt",
"recursive-include src *.zcml",
]
22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

8 changes: 5 additions & 3 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -2,10 +2,12 @@
Changes
=========

4.3.3 (unreleased)
==================
5.0 (unreleased)
================

- Add support for Python 3.9, 3.10, 3.11.

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


4.3.2 (2021-03-19)
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.
10 changes: 6 additions & 4 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
include *.md
include *.rst
include *.txt
include *.py
include buildout.cfg
include tox.ini
include .coveragerc
recursive-include src *

global-exclude *.pyc
recursive-include src *.py
recursive-include src *.txt
recursive-include src *.zcml
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
@@ -10,8 +10,8 @@
:target: https://pypi.org/project/zope.securitypolicy/
:alt: Supported Python versions

.. image:: https://travis-ci.com/zopefoundation/zope.securitypolicy.svg?branch=master
:target: https://travis-ci.com/zopefoundation/zope.securitypolicy
.. image:: https://github.com/zopefoundation/zope.securitypolicy/actions/workflows/tests.yml/badge.svg
:target: https://github.com/zopefoundation/zope.securitypolicy/actions/workflows/tests.yml

.. image:: https://coveralls.io/repos/github/zopefoundation/zope.securitypolicy/badge.svg?branch=master
:target: https://coveralls.io/github/zopefoundation/zope.securitypolicy?branch=master
7 changes: 0 additions & 7 deletions buildout.cfg

This file was deleted.

23 changes: 22 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,23 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
[bdist_wheel]
universal = 1
universal = 0

[flake8]
doctests = 1

[check-manifest]
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, pytz
known_zope =
known_first_party =
default_section = ZOPE
line_length = 79
lines_after_imports = 2
21 changes: 12 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
@@ -12,14 +12,16 @@
#
##############################################################################
# This package is developed by the Zope Toolkit project, documented here:
# http://docs.zope.org/zopetoolkit
# https://zopetoolkit.readthedocs.io/
# When developing and releasing this package, please follow the documented
# Zope Toolkit policies as described by this documentation.
##############################################################################
"""Setup for zope.securitypolicy package
"""
import os
from setuptools import setup, find_packages

from setuptools import find_packages
from setuptools import setup


def read(*rnames):
@@ -29,9 +31,9 @@ def read(*rnames):

setup(
name='zope.securitypolicy',
version='4.3.3.dev0',
version='5.0.dev0',
author='Zope Foundation and Contributors',
author_email='zope-dev@zope.org',
author_email='zope-dev@zope.dev',
description='Default security policy for Zope3',
long_description=(
read('README.rst')
@@ -46,24 +48,25 @@ 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',
'Operating System :: OS Independent',
'Topic :: Internet :: WWW/HTTP',
'Framework :: Zope :: 3'],
'Framework :: Zope :: 3',
],
url='https://github.com/zopefoundation/zope.securitypolicy',
license='ZPL 2.1',
packages=find_packages('src'),
package_dir={'': 'src'},
namespace_packages=['zope'],
python_requires='>=3.7',
install_requires=[
'persistent',
'setuptools',
7 changes: 4 additions & 3 deletions src/zope/securitypolicy/grantinfo.py
Original file line number Diff line number Diff line change
@@ -15,14 +15,15 @@
"""
from zope.annotation.interfaces import IAnnotations
from zope.interface import implementer
from zope.securitypolicy.interfaces import Unset
from zope.securitypolicy.interfaces import IGrantInfo

from zope.securitypolicy.interfaces import IGrantInfo
from zope.securitypolicy.interfaces import Unset
from zope.securitypolicy.principalpermission import \
AnnotationPrincipalPermissionManager
from zope.securitypolicy.principalrole import AnnotationPrincipalRoleManager
from zope.securitypolicy.rolepermission import AnnotationRolePermissionManager


prinperkey = AnnotationPrincipalPermissionManager.key
del AnnotationPrincipalPermissionManager

@@ -34,7 +35,7 @@


@implementer(IGrantInfo)
class AnnotationGrantInfo(object):
class AnnotationGrantInfo:

def __init__(self, context):
self._context = context
Loading

0 comments on commit 870a6d6

Please sign in to comment.