Skip to content

Commit e034c2f

Browse files
author
Michael Howitz
authored
Allow to use the package with Python 3.11. (#223)
Caution: No security audit has been done so far as Python 3.11 does not have a final version, yet. This commit is a quick hack to get tests running: Python 3.11 requires coverage >= 6 which is not supported by coverage-python-version, so we cannot use it any longer resulting in a drop of the coverage as Python 2 compatibility code no longer gets excluded from coverage. The only sane way to fix this mess is to drop Python 2 support.
1 parent ac81a60 commit e034c2f

File tree

13 files changed

+75
-28
lines changed

13 files changed

+75
-28
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
- ["3.8", "py38"]
3030
- ["3.9", "py39"]
3131
- ["3.10", "py310"]
32+
- ["3.11.0-alpha.6", "py311"]
3233
- ["3.9", "docs"]
3334
- ["3.9", "coverage"]
3435
- ["3.9", "py39-datetime"]

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ lib64
2828
log/
2929
parts/
3030
pyvenv.cfg
31+
testing.log
3132
var/

.meta.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
33
[meta]
44
template = "pure-python"
5-
commit-id = "886173bf647a6e80a985544c32053c932b1949e2"
5+
commit-id = "3a251aab94eff9cf2aa2fd87d7266593251e4b76"
66

77
[python]
88
with-pypy = false
99
with-legacy-python = true
1010
with-docs = true
1111
with-sphinx-doctests = true
1212
with-windows = true
13-
with-future-python = false
13+
with-future-python = true
1414

1515
[tox]
1616
use-flake8 = true
@@ -41,8 +41,6 @@ testenv-additional = [
4141
"deps =",
4242
" coverage",
4343
" coverage-python-version",
44-
" # Until repoze.sphinx.autointerface supports Sphinx 4.x we cannot use it:",
45-
" Sphinx < 4",
4644
" -cconstraints.txt",
4745
"setenv =",
4846
" COVERAGE_FILE=.coverage",

CHANGES.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ Changes
44
5.3 (unreleased)
55
----------------
66

7-
- Nothing changed yet.
7+
- Allow to use the package with Python 3.11 -- Caution: No security audit has
8+
been done so far.
89

910

1011
5.2 (2021-11-19)

CONTRIBUTING.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!--
2+
Generated from:
3+
https://github.com/zopefoundation/meta/tree/master/config/pure-python
4+
-->
5+
# Contributing to zopefoundation projects
6+
7+
The projects under the zopefoundation GitHub organization are open source and
8+
welcome contributions in different forms:
9+
10+
* bug reports
11+
* code improvements and bug fixes
12+
* documentation improvements
13+
* pull request reviews
14+
15+
For any changes in the repository besides trivial typo fixes you are required
16+
to sign the contributor agreement. See
17+
https://www.zope.dev/developer/becoming-a-committer.html for details.
18+
19+
Please visit our [Developer
20+
Guidelines](https://www.zope.dev/developer/guidelines.html) if you'd like to
21+
contribute code changes and our [guidelines for reporting
22+
bugs](https://www.zope.dev/developer/reporting-bugs.html) if you want to file a
23+
bug report.

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Generated from:
22
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
3+
include *.md
34
include *.rst
45
include *.txt
56
include buildout.cfg

constraints.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
# Pin Versions / Version Ranges if necessary.
44
isort >= 4.3.2
55
# Needed for Appveyor as long as PY2 is supported:
6-
pytest < 5
7-
pytest-html < 2
6+
pytest < 5 ; python_version < '3.11'
7+
# Python 3.11 needs pytest > 5
8+
pytest >= 5 ; python_version >= '3.11'
89
# coverage 6+ no longer supports Python 2 and coverage results of older
910
# versions cannot not combined with newer ones:
10-
coverage < 6
11+
coverage < 6; python_version < '3.11'
12+
# Python 3.11 requires coverage >= 6,
13+
coverage >= 6; python_version >= '3.11'

setup.cfg

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,14 @@ ignore =
1919
docs/_build/html/_sources/roadmap/*
2020
docs/_build/html/_sources/upgrade_dependencies/*
2121
docs/_build/html/_sources/usage/*
22+
23+
[isort]
24+
force_single_line = True
25+
combine_as_imports = True
26+
sections = FUTURE,STDLIB,THIRDPARTY,ZOPE,FIRSTPARTY,LOCALFOLDER
27+
known_third_party = six, docutils, pkg_resources
28+
known_zope =
29+
known_first_party =
30+
default_section = ZOPE
31+
line_length = 79
32+
lines_after_imports = 2

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
##############################################################################
1414
"""Setup for RestrictedPython package"""
1515

16+
import os
17+
1618
from setuptools import find_packages
1719
from setuptools import setup
1820

19-
import os
20-
2121

2222
def read(*rnames):
2323
with open(os.path.join(os.path.dirname(__file__), *rnames)) as f:
@@ -70,7 +70,7 @@ def read(*rnames):
7070
package_dir={'': 'src'},
7171
install_requires=[
7272
],
73-
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <3.11", # NOQA: E501
73+
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <3.12", # NOQA: E501
7474
tests_require=tests_require,
7575
extras_require={
7676
'test': tests_require,

src/RestrictedPython/Eval.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
##############################################################################
1313
"""Restricted Python Expressions."""
1414

15+
import ast
16+
1517
from ._compat import IS_PY2
1618
from .compile import compile_restricted_eval
1719

18-
import ast
19-
2020

2121
if IS_PY2: # pragma: PY2
2222
from string import maketrans

0 commit comments

Comments
 (0)