Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Python 3.13 and remove Python 3.7 support. #289

Merged
merged 11 commits into from
Oct 9, 2024
33 changes: 33 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
name: pre-commit

on:
pull_request:
push:
branches:
- master
# Allow to run this workflow manually from the Actions tab
workflow_dispatch:

env:
FORCE_COLOR: 1

jobs:
pre-commit:
name: linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- uses: pre-commit/[email protected]
with:
extra_args: --all-files --show-diff-on-failure
env:
PRE_COMMIT_COLOR: always
- uses: pre-commit-ci/[email protected]
if: always()
with:
msg: Apply pre-commit code formatting
42 changes: 22 additions & 20 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,39 +17,37 @@ jobs:
fail-fast: false
matrix:
os:
- ["ubuntu", "ubuntu-20.04"]
- ["ubuntu", "ubuntu-latest"]
- ["windows", "windows-latest"]
config:
# [Python version, tox env]
- ["3.9", "release-check"]
- ["3.9", "lint"]
- ["3.7", "py37"]
- ["3.8", "py38"]
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["3.11", "py311"]
- ["3.12", "py312"]
- ["3.13.0-alpha - 3.13.0", "py313"]
- ["3.9", "docs"]
- ["3.9", "coverage"]
- ["3.9", "py39-datetime"]
- ["3.11", "release-check"]
- ["3.8", "py38"]
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["3.11", "py311"]
- ["3.12", "py312"]
- ["3.13", "py313"]
- ["3.11", "docs"]
- ["3.11", "coverage"]
- ["3.11", "py311-datetime"]
exclude:
- { os: ["windows", "windows-latest"], config: ["3.9", "release-check"] }
- { os: ["windows", "windows-latest"], config: ["3.9", "lint"] }
- { os: ["windows", "windows-latest"], config: ["3.9", "docs"] }
- { os: ["windows", "windows-latest"], config: ["3.9", "coverage"] }
- { os: ["windows", "windows-latest"], config: ["3.11", "release-check"] }
- { os: ["windows", "windows-latest"], config: ["3.11", "docs"] }
- { os: ["windows", "windows-latest"], config: ["3.11", "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.os[0] }}-${{ matrix.config[1] }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.config[0] }}
allow-prereleases: true
- name: Pip cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.config[0] }}-${{ hashFiles('setup.*', 'tox.ini') }}
Expand All @@ -61,7 +59,11 @@ jobs:
python -m pip install --upgrade pip
pip install tox
- name: Test
if: ${{ !startsWith(runner.os, 'Mac') }}
run: tox -e ${{ matrix.config[1] }}
- name: Test (macOS)
if: ${{ startsWith(runner.os, 'Mac') }}
run: tox -e ${{ matrix.config[1] }}-universal2
- name: Coverage
if: matrix.config[1] == 'coverage'
run: |
Expand Down
18 changes: 9 additions & 9 deletions .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
[meta]
template = "pure-python"
commit-id = "cb0568c7"
commit-id = "d3455844"

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

[tox]
use-flake8 = true
additional-envlist = [
"py39-datetime",
"py311-datetime",
"combined-coverage",
]
testenv-deps = [
Expand All @@ -28,7 +28,7 @@ testenv-setenv = [
]
testenv-commands = [
"python -V",
"pytest --cov=src --cov=tests --cov-report= {posargs}",
"pytest --cov=src --cov=tests --cov-report= tests {posargs}",
]
testenv-additional = [
"",
Expand All @@ -47,16 +47,15 @@ testenv-additional = [
" coverage combine",
" coverage html",
" coverage report -m --fail-under=100",
"depends = py37,py38,py39,py39-datetime,py310,py311,py312,coverage",
"depends = py38,py39,py310,py311,py311-datetime,py312,py313,coverage",
]
coverage-basepython = "python3.8"
coverage-command = "pytest --cov=src --cov=tests --cov-report= {posargs}"
coverage-command = "pytest --cov=src --cov=tests --cov-report= tests {posargs}"
coverage-setenv = [
"COVERAGE_FILE=.coverage",
]

[coverage]
fail-under = 98.4
fail-under = 97.9

[isort]
additional-sources = "{toxinidir}/tests"
Expand All @@ -82,9 +81,10 @@ additional-ignores = [
"docs/_build/html/_sources/roadmap/*",
"docs/_build/html/_sources/upgrade_dependencies/*",
"docs/_build/html/_sources/usage/*",
"docs/_build/html/_static/scripts/*",
]

[github-actions]
additional-config = [
"- [\"3.9\", \"py39-datetime\"]",
"- [\"3.11\", \"py311-datetime\"]",
]
28 changes: 28 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
minimum_pre_commit_version: '3.6'
repos:
- repo: https://github.com/pycqa/isort
rev: "5.13.2"
hooks:
- id: isort
- repo: https://github.com/hhatto/autopep8
rev: "v2.3.1"
hooks:
- id: autopep8
args: [--in-place, --aggressive, --aggressive]
- repo: https://github.com/asottile/pyupgrade
rev: v3.17.0
hooks:
- id: pyupgrade
args: [--py38-plus]
- repo: https://github.com/isidentical/teyit
rev: 0.4.3
hooks:
- id: teyit
- repo: https://github.com/PyCQA/flake8
rev: "7.1.1"
hooks:
- id: flake8
additional_dependencies:
- flake8-debugger == 4.1.2
5 changes: 3 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ Changes
7.4 (unreleased)
----------------

- Allow to use the package with Python 3.13 -- Caution: No security
audit has been done so far.
- Allow to use the package with Python 3.13.

- Drop support for Python 3.7.

- Provide new function ``RestrictedPython.Guards.safer_getattr_raise``.
It is similar to ``safer_getattr`` but handles its parameter
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ include *.rst
include *.txt
include buildout.cfg
include tox.ini
include .pre-commit-config.yaml

recursive-include docs *.py
recursive-include docs *.rst
Expand Down
24 changes: 16 additions & 8 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
# sys.path.insert(0, os.path.abspath('.'))

import datetime


# -- General configuration ------------------------------------------------

year = datetime.datetime.now().year

# If your documentation needs a minimal Sphinx version, state it here.
# needs_sphinx = '1.0'

Expand All @@ -37,7 +42,7 @@
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = {'.rst': 'restructuredtext'}

# The encoding of source files.
# source_encoding = 'utf-8-sig'
Expand All @@ -47,17 +52,17 @@

# General information about the project.
project = 'RestrictedPython'
copyright = '2017-2023, Zope Foundation and Contributors'
copyright = f'2017-{year}, Zope Foundation and Contributors'
author = 'The Zope & Plone developer community'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '7.0'
version = '7.4'
# The full version, including alpha/beta/rc tags.
release = '7.0'
release = '7.4'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -107,12 +112,12 @@
# Intersphinx Mapping for Links between different Documentations
intersphinx_mapping = {
'python3': ('https://docs.python.org/3', None),
'python37': ('https://docs.python.org/3.7', None),
'python38': ('https://docs.python.org/3.8', None),
'python39': ('https://docs.python.org/3.9', None),
'python310': ('https://docs.python.org/3.10', None),
'python311': ('https://docs.python.org/3.11', None),
'python312': ('https://docs.python.org/3.12', None),
'python313': ('https://docs.python.org/3.13', None),
}

# Options for sphinx.ext.todo:
Expand All @@ -123,7 +128,7 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
html_theme = 'furo'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down Expand Up @@ -274,8 +279,11 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'restrictedpython', 'RestrictedPython Documentation', [author], 1)
]
(master_doc,
'restrictedpython',
'RestrictedPython Documentation',
[author],
1)]

# If true, show URL addresses after external links.
# man_show_urls = False
Expand Down
Loading