summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2024-01-27 11:22:54 -0700
committerGitHub <noreply@github.com>2024-01-27 11:22:54 -0700
commit165b16c822754c61faa46d2b64ce3cad4e183cd4 (patch)
tree1d31056cd55aa19801b4ae104cf92f022336a32f
parent3739a7790ba92c34098df3d804f27a1d8429f9fe (diff)
parentca7325944a807694030bc342132aefd0efeea342 (diff)
downloadpyramid-165b16c822754c61faa46d2b64ce3cad4e183cd4.tar.gz
pyramid-165b16c822754c61faa46d2b64ce3cad4e183cd4.tar.bz2
pyramid-165b16c822754c61faa46d2b64ce3cad4e183cd4.zip
Merge pull request #3737 from Jmennius/support-python-3.12
Add 3.12 to CI, tox and metadata; use latest black and flake8
-rw-r--r--.github/workflows/ci-tests.yml5
-rw-r--r--.readthedocs.yaml2
-rw-r--r--HACKING.txt2
-rw-r--r--docs/narr/install.rst2
-rw-r--r--docs/narr/upgrading.rst1
-rw-r--r--setup.py1
-rw-r--r--src/pyramid/config/adapters.py8
-rw-r--r--src/pyramid/config/routes.py2
-rw-r--r--src/pyramid/config/tweens.py1
-rw-r--r--src/pyramid/config/views.py6
-rw-r--r--src/pyramid/encode.py2
-rw-r--r--src/pyramid/interfaces.py2
-rw-r--r--src/pyramid/registry.py1
-rw-r--r--src/pyramid/router.py1
-rw-r--r--src/pyramid/scripts/pserve.py1
-rw-r--r--src/pyramid/traversal.py1
-rw-r--r--src/pyramid/util.py1
-rw-r--r--tests/test_traversal.py1
-rw-r--r--tox.ini14
19 files changed, 24 insertions, 30 deletions
diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml
index 4f2aaa9bc..cc1df08ae 100644
--- a/.github/workflows/ci-tests.yml
+++ b/.github/workflows/ci-tests.yml
@@ -20,6 +20,7 @@ jobs:
- "3.9"
- "3.10"
- "3.11"
+ - "3.12"
- "pypy-3.8"
os:
- "ubuntu-20.04"
@@ -64,10 +65,10 @@ jobs:
- name: Setup python
uses: actions/setup-python@v4
with:
- python-version: 3.11
+ python-version: 3.12
architecture: x64
- run: pip install tox
- - run: tox -e py311-cover,coverage
+ - run: tox -e py312-cover,coverage
docs:
runs-on: ubuntu-20.04
name: Build the documentation
diff --git a/.readthedocs.yaml b/.readthedocs.yaml
index d45905a5d..218fdb215 100644
--- a/.readthedocs.yaml
+++ b/.readthedocs.yaml
@@ -3,7 +3,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
- python: '3.11'
+ python: '3.12'
sphinx:
configuration: docs/conf.py
formats:
diff --git a/HACKING.txt b/HACKING.txt
index bb7045ed6..f7c569a01 100644
--- a/HACKING.txt
+++ b/HACKING.txt
@@ -51,7 +51,7 @@ In order to add a feature to Pyramid:
(in `docs/`).
- The feature must work fully on the following CPython versions: 3.7, 3.8, 3.9,
- 3.10, and 3.11 on both UNIX and Windows.
+ 3.10, 3.11, and 3.12 on both UNIX and Windows.
- The feature must work on the latest version of PyPy3.
diff --git a/docs/narr/install.rst b/docs/narr/install.rst
index d07692d86..c40cd7403 100644
--- a/docs/narr/install.rst
+++ b/docs/narr/install.rst
@@ -22,7 +22,7 @@ the following sections.
.. sidebar:: Python Versions
As of this writing, :app:`Pyramid` is tested against Python 3.7,
- 3.8, 3.9, 3.10, 3.11 and PyPy (matches CPython version 3.8).
+ 3.8, 3.9, 3.10, 3.11, 3.12 and PyPy (matches CPython version 3.8).
:app:`Pyramid` is known to run on all popular Unix-like systems such as Linux,
macOS, and FreeBSD, as well as on Windows platforms. It is also known to
diff --git a/docs/narr/upgrading.rst b/docs/narr/upgrading.rst
index 5fc3dc9fa..64d51c024 100644
--- a/docs/narr/upgrading.rst
+++ b/docs/narr/upgrading.rst
@@ -91,6 +91,7 @@ Python is when security updates are no longer released.
- `Python 3.9 Lifespan <https://devguide.python.org/versions/#versions>`_ 2025-10.
- `Python 3.10 Lifespan <https://devguide.python.org/versions/#versions>`_ 2026-10.
- `Python 3.11 Lifespan <https://devguide.python.org/versions/#versions>`_ 2027-10.
+- `Python 3.12 Lifespan <https://devguide.python.org/versions/#versions>`_ 2028-10.
To determine the Python support for a specific release of Pyramid, view its
``tox.ini`` file at the root of the repository's version.
diff --git a/setup.py b/setup.py
index 42d7d91a2..7fab10b71 100644
--- a/setup.py
+++ b/setup.py
@@ -79,6 +79,7 @@ setup(
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
+ "Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Framework :: Pyramid",
diff --git a/src/pyramid/config/adapters.py b/src/pyramid/config/adapters.py
index a64c251ca..312dfe1f9 100644
--- a/src/pyramid/config/adapters.py
+++ b/src/pyramid/config/adapters.py
@@ -76,8 +76,6 @@ class AdaptersConfiguratorMixin:
return subscriber
def _derive_predicate(self, predicate):
- derived_predicate = predicate
-
if eventonly(predicate):
def derived_predicate(*arg):
@@ -85,12 +83,12 @@ class AdaptersConfiguratorMixin:
# seems pointless to try to fix __doc__, __module__, etc as
# predicate will invariably be an instance
+ else:
+ derived_predicate = predicate
return derived_predicate
def _derive_subscriber(self, subscriber, predicates):
- derived_subscriber = subscriber
-
if eventonly(subscriber):
def derived_subscriber(*arg):
@@ -98,6 +96,8 @@ class AdaptersConfiguratorMixin:
if hasattr(subscriber, '__name__'):
update_wrapper(derived_subscriber, subscriber)
+ else:
+ derived_subscriber = subscriber
if not predicates:
return derived_subscriber
diff --git a/src/pyramid/config/routes.py b/src/pyramid/config/routes.py
index a7ff66a47..409f36849 100644
--- a/src/pyramid/config/routes.py
+++ b/src/pyramid/config/routes.py
@@ -542,7 +542,7 @@ class RoutesConfiguratorMixin:
def add_default_route_predicates(self):
p = pyramid.predicates
- for (name, factory) in (
+ for name, factory in (
('xhr', p.XHRPredicate),
('request_method', p.RequestMethodPredicate),
('path_info', p.PathInfoPredicate),
diff --git a/src/pyramid/config/tweens.py b/src/pyramid/config/tweens.py
index 0eeac333e..1cf6d9262 100644
--- a/src/pyramid/config/tweens.py
+++ b/src/pyramid/config/tweens.py
@@ -102,7 +102,6 @@ class TweensConfiguratorMixin:
@action_method
def _add_tween(self, tween_factory, under=None, over=None, explicit=False):
-
if not isinstance(tween_factory, str):
raise ConfigurationError(
'The "tween_factory" argument to add_tween must be a '
diff --git a/src/pyramid/config/views.py b/src/pyramid/config/views.py
index 4f5806df3..fababf542 100644
--- a/src/pyramid/config/views.py
+++ b/src/pyramid/config/views.py
@@ -886,7 +886,7 @@ class ViewsConfiguratorMixin:
pvals = {}
dvals = {}
- for (k, v) in ovals.items():
+ for k, v in ovals.items():
if k in valid_predicates:
pvals[k] = v
else:
@@ -1206,7 +1206,7 @@ class ViewsConfiguratorMixin:
def add_default_view_predicates(self):
p = pyramid.predicates
- for (name, factory) in (
+ for name, factory in (
('xhr', p.XHRPredicate),
('request_method', p.RequestMethodPredicate),
('path_info', p.PathInfoPredicate),
@@ -2163,7 +2163,7 @@ class StaticURLInfo:
self.cache_busters = []
def generate(self, path, request, **kw):
- for (url, spec, route_name) in self.registrations:
+ for url, spec, route_name in self.registrations:
if path.startswith(spec):
subpath = path[len(spec) :]
if WIN: # pragma: no cover
diff --git a/src/pyramid/encode.py b/src/pyramid/encode.py
index 153940534..f97af4fa4 100644
--- a/src/pyramid/encode.py
+++ b/src/pyramid/encode.py
@@ -64,7 +64,7 @@ def urlencode(query, doseq=True, quote_via=quote_plus):
result = ''
prefix = ''
- for (k, v) in query:
+ for k, v in query:
k = quote_via(k)
if is_nonstr_iter(v):
diff --git a/src/pyramid/interfaces.py b/src/pyramid/interfaces.py
index 6221cc21e..4ee294189 100644
--- a/src/pyramid/interfaces.py
+++ b/src/pyramid/interfaces.py
@@ -921,7 +921,6 @@ ILogger = IDebugLogger # b/c
class IRoutePregenerator(Interface):
def __call__(request, elements, kw):
-
"""A pregenerator is a function associated by a developer with a
:term:`route`. The pregenerator for a route is called by
:meth:`pyramid.request.Request.route_url` in order to adjust the set
@@ -1384,7 +1383,6 @@ class IIntrospectable(Interface):
""" # noqa: E501
def __hash__():
-
"""Introspectables must be hashable. The typical implementation of
an introsepectable's __hash__ is::
diff --git a/src/pyramid/registry.py b/src/pyramid/registry.py
index 971ae786a..0b983a6c5 100644
--- a/src/pyramid/registry.py
+++ b/src/pyramid/registry.py
@@ -208,7 +208,6 @@ class Introspector:
@implementer(IIntrospectable)
class Introspectable(dict):
-
order = 0 # mutated by introspector.add
action_info = None # mutated by self.register
diff --git a/src/pyramid/router.py b/src/pyramid/router.py
index 61660c41b..0b7554e23 100644
--- a/src/pyramid/router.py
+++ b/src/pyramid/router.py
@@ -28,7 +28,6 @@ from pyramid.view import _call_view
@implementer(IRouter)
class Router:
-
debug_notfound = False
debug_routematch = False
diff --git a/src/pyramid/scripts/pserve.py b/src/pyramid/scripts/pserve.py
index 0c4782ce5..8eb0ca52f 100644
--- a/src/pyramid/scripts/pserve.py
+++ b/src/pyramid/scripts/pserve.py
@@ -31,7 +31,6 @@ def main(argv=sys.argv, quiet=False, original_ignore_files=None):
class PServeCommand:
-
description = """\
This command serves a web application that uses a PasteDeploy
configuration file for the server and application.
diff --git a/src/pyramid/traversal.py b/src/pyramid/traversal.py
index 00b64bae2..986069d1d 100644
--- a/src/pyramid/traversal.py
+++ b/src/pyramid/traversal.py
@@ -597,7 +597,6 @@ class ResourceTreeTraverser:
matchdict = request.matchdict
if matchdict is not None:
-
path = matchdict.get('traverse', '/') or '/'
if is_nonstr_iter(path):
# this is a *traverse stararg (not a {traverse})
diff --git a/src/pyramid/util.py b/src/pyramid/util.py
index 8d384cc84..f396712f3 100644
--- a/src/pyramid/util.py
+++ b/src/pyramid/util.py
@@ -683,7 +683,6 @@ def takes_one_arg(callee, attr=None, argname=None):
return True
if argname:
-
defaults = argspec[3]
if defaults is None:
defaults = ()
diff --git a/tests/test_traversal.py b/tests/test_traversal.py
index 0d8096f15..36b131242 100644
--- a/tests/test_traversal.py
+++ b/tests/test_traversal.py
@@ -1271,7 +1271,6 @@ class DummyContext:
class DummyRequest:
-
application_url = (
'http://example.com:5432' # app_url never ends with slash
)
diff --git a/tox.ini b/tox.ini
index 592388f56..84e74a446 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,8 +1,8 @@
[tox]
envlist =
lint,
- py37,py38,py39,py310,py311,pypy3,
- py311-cover,coverage,
+ py37,py38,py39,py310,py311,py312,pypy3,
+ py312-cover,coverage,
docs
isolated_build = true
@@ -16,7 +16,7 @@ extras =
setenv =
COVERAGE_FILE=.coverage.{envname}
-[testenv:py311-cover]
+[testenv:py312-cover]
commands =
python --version
pytest --cov {posargs:}
@@ -32,9 +32,9 @@ commands =
python -m build .
twine check dist/*
deps =
- flake8~=5.0.4
- black~=22.12.0
- isort~=5.10
+ flake8~=6.1.0
+ black~=23.11.0
+ isort~=5.12
build
check-manifest
readme_renderer
@@ -64,7 +64,7 @@ deps =
coverage
setenv =
COVERAGE_FILE=.coverage
-depends = py311-cover
+depends = py312-cover
[testenv:format]
skip_install = true