Skip to content

Commit

Permalink
Add support for Python 3.10 and 3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed May 5, 2023
1 parent df435ff commit bd8ccba
Show file tree
Hide file tree
Showing 13 changed files with 413 additions and 177 deletions.
87 changes: 46 additions & 41 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,65 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
name: tests

on: [push, pull_request]

env:
PYTHONHASHSEED: 1042466059
ZOPE_INTERFACE_STRICT_IRO: 1

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:
test:
build:
strategy:
# We want to see all failures:
fail-fast: false
matrix:
python-version: [2.7, pypy2, pypy3, 3.6, 3.7, 3.8, 3.9]
os:
- ["ubuntu", "ubuntu-20.04"]
config:
# [Python version, tox env]
- ["3.9", "lint"]
- ["2.7", "py27"]
- ["3.6", "py36"]
- ["3.7", "py37"]
- ["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: ubuntu-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.python-version }}
python-version: ${{ matrix.config[0] }}
- name: Pip cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('setup.*') }}
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 -U pip setuptools wheel
python -m pip install -U coverage
python -m pip install -U -e ".[test,docs]"
- name: Lint
run: |
python -m pip install -U pylint
pylint nti.transactions
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: |
coverage run -m zope.testrunner --test-path=src --auto-color --auto-progress
coverage run -a -m sphinx -b doctest -d docs/_build/doctrees docs docs/_build/doctests
- name: Report Coverage
run: |
coverage combine || true
coverage report -i
- name: Submit to Coveralls
# This is a container action, which only runs on Linux.
uses: AndreMiras/coveralls-python-action@develop
with:
parallel: true

coveralls_finish:
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: AndreMiras/coveralls-python-action@develop
with:
parallel-finished: true
pip install coveralls coverage-python-version
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
165 changes: 144 additions & 21 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,80 @@
[MASTER]
load-plugins=pylint.extensions.bad_builtin,
pylint.extensions.code_style,
pylint.extensions.dict_init_mutate,
pylint.extensions.dunder,
pylint.extensions.emptystring,
pylint.extensions.comparetozero,
pylint.extensions.comparison_placement,
pylint.extensions.confusing_elif,
pylint.extensions.for_any_all,
pylint.extensions.consider_refactoring_into_while_condition,
pylint.extensions.mccabe,
pylint.extensions.check_elif,
pylint.extensions.eq_without_hash,
pylint.extensions.overlapping_exceptions,

# Requires you to have parameters docemented with types.
# This is a good thing! But there are a bunch of cases that don't
# have it here, and right now I don't want to add them.
# pylint.extensions.docparams,

# Prevents you from doing::
#
# stmts = [make_part(p) for p in stuff]
# stmts = ''.join(stmts)
#
# We use that pattern a lot here.
# pylint.extensions.redefined_variable_type,

# magic_value wants you to not use arbitrary strings and numbers
# inline in the code. But it's overzealous and has way too many false
# positives. Trust people to do the most readable thing.
# pylint.extensions.magic_value

# Empty comment would be good, except it detects blank lines within
# a single comment block.
#
# Those are often used to separate paragraphs, like here.
# pylint.extensions.empty_comment,

# consider_ternary_expression is a nice check, but is also overzealous.
# Trust the human to do the readable thing.
# pylint.extensions.consider_ternary_expression,

# redefined_loop_name tends to catch us with things like
# for name in (a, b, c): name = name + '_column' ...
# pylint.extensions.redefined_loop_name,

# This wants you to turn ``x in (1, 2)`` into ``x in {1, 2}``.
# They both result in the LOAD_CONST bytecode, one a tuple one a
# frozenset. In theory a set lookup using hashing is faster than
# a linear scan of a tuple; but if the tuple is small, it can often
# actually be faster to scan the tuple.
# pylint.extensions.set_membership,

# Fix zope.cachedescriptors.property.Lazy; the property-classes doesn't seem to
# do anything.
# https://stackoverflow.com/questions/51160955/pylint-how-to-specify-a-self-defined-property-decorator-with-property-classes
# For releases prior to 2.14.2, this needs to be a one-line, quoted string. After that,
# a multi-line string.
# - Make zope.cachedescriptors.property.Lazy look like a property;
# fixes pylint thinking it is a method.
# - Run in Pure Python mode (ignore C extensions that respect this);
# fixes some issues with zope.interface, like IFoo.providedby(ob)
# claiming not to have the right number of parameters...except no, it does not.
init-hook =
import astroid.bases
astroid.bases.POSSIBLE_PROPERTIES.add('Lazy')
astroid.bases.POSSIBLE_PROPERTIES.add('readproperty')
astroid.bases.POSSIBLE_PROPERTIES.add('non_overridable')
import os
os.environ['PURE_PYTHON'] = ("1")
# Ending on a quoted string
# breaks pylint 2.14.5 (it strips the trailing quote. This is
# probably because it tries to handle one-line quoted strings as well as multi-blocks).
# The parens around it fix the issue.


[MESSAGES CONTROL]

Expand Down Expand Up @@ -28,69 +105,115 @@
# see https://github.com/PyCQA/pylint/issues/846
# useless-suppression: the only way to avoid repeating it for specific statements everywhere that we
# do Py2/Py3 stuff is to put it here. Sadly this means that we might get better but not realize it.
# duplicate-code: Yeah, the compatibility ssl modules are much the same
# In pylint 1.8.0, inconsistent-return-statements are created for the wrong reasons.
# This code raises it, even though there is only one return (the implicit ``return None`` is presumably
# what triggers it):
# def foo():
# if baz:
# return 1
# In Pylint 2dev1, needed for Python 3.7, we get spurious "useless return" errors:
# @property
# def foo(self):
# return None # generates useless-return
# Pylint 2.4 adds import-outside-toplevel. But we do that a lot to defer imports because of patching.
# Pylint 2.4 adds self-assigning-variable. But we do *that* to avoid unused-import when we
# "export" the variable and dont have a __all__.
# Pylint 2.6+ adds some python-3-only things that dont apply: raise-missing-from, super-with-arguments, consider-using-f-string, redundant-u-string-prefix
# cyclic import is added because it pylint is spuriously detecting that
# consider-using-assignment-expr wants you to transform things like:
# foo = get_foo()
# if foo: ...
#
# Into ``if (foo := get_foo()):``
# But there are a *lot* of those. Trust people to do the right, most
# readable, thing
# raise-missing-from: Py2 compatibility
# super-with-arguments: Py2
disable=wrong-import-position,
wrong-import-order,
missing-docstring,
ungrouped-imports,
invalid-name,
protected-access,
no-self-use,
too-few-public-methods,
exec-used,
global-statement,
multiple-statements,
locally-disabled,
cyclic-import,
too-many-arguments,
redefined-builtin,
useless-suppression,
duplicate-code,
useless-object-inheritance,
import-outside-toplevel,
self-assigning-variable,
consider-using-f-string,
consider-using-assignment-expr,
use-dict-literal,
raise-missing-from,
super-with-arguments,
bad-option-value
# undefined-all-variable
redundant-u-string-prefix

enable=consider-using-augmented-assign

[FORMAT]
# duplicated from setup.cfg
max-line-length=160
max-line-length=100
max-module-lines=1100

[MISCELLANEOUS]
# List of note tags to take in consideration, separated by a comma.
#notes=FIXME,XXX,TODO
# Disable that, we don't want them in the report (???)
# Disable that, we don't want them to fail the lint CI job.
notes=

[VARIABLES]

dummy-variables-rgx=_.*
init-import=true

[TYPECHECK]

# List of members which are set dynamically and missed by pylint inference
# system, and so shouldn't trigger E1101 when accessed. Python regular
# system, and so shouldnt trigger E1101 when accessed. Python regular
# expressions are accepted.
# gevent: this is helpful for py3/py2 code.
generated-members=exc_clear
generated-members=REQUEST,acl_users,aq_parent,providedBy


# Tells whether missing members accessed in mixin class should be ignored. A
# mixin class is detected if its name ends with "mixin" (case insensitive).
# XXX: deprecated in 2.14; replaced with ignored-checks-for-mixins.
# The defaults for that value seem to be what we want
#ignore-mixin-members=yes

# List of classes names for which member attributes should not be checked
# (useful for classes with attributes dynamically set). This supports can work
# (useful for classes with attributes dynamically set). This can work
# with qualified names.
# greenlet, Greenlet, parent, dead: all attempts to fix issues in greenlet.py
# only seen on the service, e.g., self.parent.loop: class parent has no loop
ignored-classes=SSLContext, SSLSocket, greenlet, Greenlet, parent, dead
#ignored-classes=SSLContext, SSLSocket, greenlet, Greenlet, parent, dead


# List of module names for which member attributes should not be checked
# (useful for modules/projects where namespaces are manipulated during runtime
# and thus existing member attributes cannot be deduced by static analysis. It
# supports qualified module names, as well as Unix pattern matching.
ignored-modules=gevent._corecffi
#ignored-modules=gevent._corecffi,gevent.os,os,greenlet,threading,gevent.libev.corecffi,gevent.socket,gevent.core,gevent.testing.support

[DESIGN]
max-attributes=12
max-parents=10
# Bump complexity up one.
max-complexity=11

[BASIC]
bad-functions=input
# Prospector turns ot unsafe-load-any-extension by default, but
# pylint leaves it off. This is the proximal cause of the
# undefined-all-variable crash.
#unsafe-load-any-extension = no
unsafe-load-any-extension = yes
# This does not seem to work, hence the init-hook
property-classes=zope.cachedescriptors.property.Lazy,zope.cachedescriptors.property.Cached

[CLASSES]
# List of interface methods to ignore, separated by a comma. This is used for
# instance to not check methods defines in Zope's Interface base class.



# Local Variables:
# mode: conf
# End:
37 changes: 37 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Some things can only be configured on the RTD dashboard.
# Those that we may have changed from the default include:

# Analytics code:
# Show Version Warning: False
# Single Version: True

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
builder: html
configuration: docs/conf.py

# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.11"
# You can also specify other tool versions:
# nodejs: "19"
# rust: "1.64"
# golang: "1.19"

# Set the version of Python and requirements required to build your
# docs
python:
install:
- method: pip
path: .
extra_requirements:
- docs
4 changes: 2 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
Changes
=========

4.2.2 (unreleased)
4.3.0 (unreleased)
==================

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


4.2.1 (2021-05-25)
Expand Down

0 comments on commit bd8ccba

Please sign in to comment.