Skip to content

Commit

Permalink
Add 3.12 to CI, tox and metadata; use latest black and flake8
Browse files Browse the repository at this point in the history
Signed-off-by: Ievgen Popovych <jmennius@gmail.com>
  • Loading branch information
Jmennius committed Nov 30, 2023
1 parent 3739a77 commit 3678b4d
Show file tree
Hide file tree
Showing 16 changed files with 21 additions and 28 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "pypy-3.8"
os:
- "ubuntu-20.04"
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: '3.11'
python: '3.12'
sphinx:
configuration: docs/conf.py
formats:
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def readfile(name):
"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",
Expand Down
8 changes: 4 additions & 4 deletions src/pyramid/config/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,28 +76,28 @@ def register():
return subscriber

def _derive_predicate(self, predicate):
derived_predicate = predicate

if eventonly(predicate):

def derived_predicate(*arg):
return predicate(arg[0])

# 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):
return subscriber(arg[0])

if hasattr(subscriber, '__name__'):
update_wrapper(derived_subscriber, subscriber)
else:
derived_subscriber = subscriber

if not predicates:
return derived_subscriber
Expand Down
2 changes: 1 addition & 1 deletion src/pyramid/config/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ def add_route_predicate(

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),
Expand Down
1 change: 0 additions & 1 deletion src/pyramid/config/tweens.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ def add_default_tweens(self):

@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 '
Expand Down
6 changes: 3 additions & 3 deletions src/pyramid/config/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ def discrim_func():
pvals = {}
dvals = {}

for (k, v) in ovals.items():
for k, v in ovals.items():
if k in valid_predicates:
pvals[k] = v
else:
Expand Down Expand Up @@ -1206,7 +1206,7 @@ def add_view_predicate(

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),
Expand Down Expand Up @@ -2163,7 +2163,7 @@ def __init__(self):
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
Expand Down
2 changes: 1 addition & 1 deletion src/pyramid/encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 0 additions & 2 deletions src/pyramid/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,6 @@ class IDebugLogger(Interface):

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
Expand Down Expand Up @@ -1384,7 +1383,6 @@ def register(self, introspector, action_info):
""" # noqa: E501

def __hash__():

"""Introspectables must be hashable. The typical implementation of
an introsepectable's __hash__ is::
Expand Down
1 change: 0 additions & 1 deletion src/pyramid/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ def related(self, intr):

@implementer(IIntrospectable)
class Introspectable(dict):

order = 0 # mutated by introspector.add
action_info = None # mutated by self.register

Expand Down
1 change: 0 additions & 1 deletion src/pyramid/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

@implementer(IRouter)
class Router:

debug_notfound = False
debug_routematch = False

Expand Down
1 change: 0 additions & 1 deletion src/pyramid/scripts/pserve.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion src/pyramid/traversal.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,6 @@ def __call__(self, request):
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})
Expand Down
1 change: 0 additions & 1 deletion src/pyramid/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ()
Expand Down
1 change: 0 additions & 1 deletion tests/test_traversal.py
Original file line number Diff line number Diff line change
Expand Up @@ -1271,7 +1271,6 @@ def __repr__(self):


class DummyRequest:

application_url = (
'http://example.com:5432' # app_url never ends with slash
)
Expand Down
14 changes: 7 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -16,7 +16,7 @@ extras =
setenv =
COVERAGE_FILE=.coverage.{envname}

[testenv:py311-cover]
[testenv:py312-cover]
commands =
python --version
pytest --cov {posargs:}
Expand All @@ -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
Expand Down Expand Up @@ -64,7 +64,7 @@ deps =
coverage
setenv =
COVERAGE_FILE=.coverage
depends = py311-cover
depends = py312-cover

[testenv:format]
skip_install = true
Expand Down

0 comments on commit 3678b4d

Please sign in to comment.