Skip to content

Commit b06ee75

Browse files
Merge pull request #459 from Pylons/add-py312
add py3.12, drop py3.7, pyupgrade 3.8+
2 parents 7073be5 + d3724c1 commit b06ee75

File tree

21 files changed

+105
-86
lines changed

21 files changed

+105
-86
lines changed

.github/workflows/ci-tests.yml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,36 +16,51 @@ jobs:
1616
strategy:
1717
matrix:
1818
py:
19-
- "3.7"
2019
- "3.8"
2120
- "3.9"
2221
- "3.10"
2322
- "3.11"
23+
- "3.12"
2424
- "pypy-3.8"
25+
- "pypy-3.9"
26+
- "pypy-3.10"
2527
os:
2628
- "ubuntu-latest"
2729
- "windows-latest"
2830
- "macos-latest"
2931
architecture:
3032
- x64
3133
- x86
32-
34+
include:
35+
- py: "pypy-3.8"
36+
toxenv: "pypy38"
37+
- py: "pypy-3.9"
38+
toxenv: "pypy39"
39+
- py: "pypy-3.10"
40+
toxenv: "pypy310"
3341
exclude:
3442
# Linux and macOS don't have x86 python
3543
- os: "ubuntu-latest"
3644
architecture: x86
3745
- os: "macos-latest"
3846
architecture: x86
39-
# PyPy on Windows is a no go
47+
# Don't run all PyPy versions except latest on
48+
# Windows/macOS. They are expensive to run.
4049
- os: "windows-latest"
4150
py: "pypy-3.8"
51+
- os: "macos-latest"
52+
py: "pypy-3.8"
53+
- os: "windows-latest"
54+
py: "pypy-3.9"
55+
- os: "macos-latest"
56+
py: "pypy-3.9"
4257

4358
name: "Python: ${{ matrix.py }}-${{ matrix.architecture }} on ${{ matrix.os }}"
4459
runs-on: ${{ matrix.os }}
4560
steps:
4661
- uses: actions/checkout@v4
4762
- name: Setup python
48-
uses: actions/setup-python@v4
63+
uses: actions/setup-python@v5
4964
with:
5065
python-version: ${{ matrix.py }}
5166
architecture: ${{ matrix.architecture }}
@@ -58,7 +73,7 @@ jobs:
5873
steps:
5974
- uses: actions/checkout@v4
6075
- name: Setup python 3.8
61-
uses: actions/setup-python@v4
76+
uses: actions/setup-python@v5
6277
with:
6378
python-version: 3.8
6479
architecture: x64
@@ -71,7 +86,7 @@ jobs:
7186
steps:
7287
- uses: actions/checkout@v4
7388
- name: Setup python
74-
uses: actions/setup-python@v4
89+
uses: actions/setup-python@v5
7590
with:
7691
python-version: 3.8
7792
architecture: x64
@@ -83,7 +98,7 @@ jobs:
8398
steps:
8499
- uses: actions/checkout@v4
85100
- name: Setup python
86-
uses: actions/setup-python@v4
101+
uses: actions/setup-python@v5
87102
with:
88103
python-version: 3.8
89104
architecture: x64

.readthedocs.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# https://docs.readthedocs.io/en/stable/config-file/v2.html
2+
version: 2
3+
build:
4+
os: ubuntu-22.04
5+
tools:
6+
python: '3.12'
7+
sphinx:
8+
configuration: docs/conf.py
9+
python:
10+
install:
11+
- method: pip
12+
path: .
13+
extra_requirements:
14+
- docs

CHANGES.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
Unreleased
22
----------
33

4-
- Rename "master" git branch to "main"
5-
64
Feature
75
~~~~~~~
86

7+
- Rename "master" git branch to "main"
8+
9+
- Add support for Python 3.12.
10+
911
- Add Request.remote_host, exposing REMOTE_HOST environment variable.
1012

1113
- Added ``acceptparse.Accept.parse_offer`` to codify what types of offers
@@ -23,6 +25,7 @@ Compatibility
2325
Backwards Incompatibilities
2426
~~~~~~~~~~~~~~~~~~~~~~~~~~~
2527

28+
- Drop support for Python 2.7, 3.4, 3.5, 3.6, and 3.7.
2629

2730
Experimental Features
2831
~~~~~~~~~~~~~~~~~~~~~

MANIFEST.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ graft tests
66
include README.rst
77
include CHANGES.txt HISTORY.txt
88
include contributing.md RELEASING.rst
9-
include .coveragerc .flake8 pyproject.toml
10-
include tox.ini appveyor.yml .travis.yml rtd.txt
9+
include pyproject.toml
10+
include .coveragerc .flake8 tox.ini
11+
include .readthedocs.yaml
1112

1213
global-exclude __pycache__ *.py[cod]
1314
global-exclude .DS_Store

docs/api/webob.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,53 +31,53 @@ methods:
3131

3232
.. autoclass:: AcceptValidHeader
3333
:members: parse, header_value, parsed, __init__, __add__, __bool__,
34-
__contains__, __iter__, __nonzero__, __radd__, __repr__, __str__,
34+
__contains__, __iter__, __radd__, __repr__, __str__,
3535
accept_html, accepts_html, acceptable_offers, best_match, quality
3636

3737
.. autoclass:: AcceptNoHeader
3838
:members: parse, header_value, parsed, __init__, __add__, __bool__,
39-
__contains__, __iter__, __nonzero__, __radd__, __repr__, __str__,
39+
__contains__, __iter__, __radd__, __repr__, __str__,
4040
accept_html, accepts_html, acceptable_offers, best_match, quality
4141

4242
.. autoclass:: AcceptInvalidHeader
4343
:members: parse, header_value, parsed, __init__, __add__, __bool__,
44-
__contains__, __iter__, __nonzero__, __radd__, __repr__, __str__,
44+
__contains__, __iter__, __radd__, __repr__, __str__,
4545
accept_html, accepts_html, acceptable_offers, best_match, quality
4646

4747
.. autoclass:: AcceptCharset
4848
:members: parse
4949

5050
.. autoclass:: AcceptCharsetValidHeader
5151
:members: parse, header_value, parsed, __init__, __add__, __bool__,
52-
__contains__, __iter__, __nonzero__, __radd__, __repr__, __str__,
52+
__contains__, __iter__, __radd__, __repr__, __str__,
5353
acceptable_offers, best_match, quality
5454

5555
.. autoclass:: AcceptCharsetNoHeader
5656
:members: parse, header_value, parsed, __init__, __add__, __bool__,
57-
__contains__, __iter__, __nonzero__, __radd__, __repr__, __str__,
57+
__contains__, __iter__, __radd__, __repr__, __str__,
5858
acceptable_offers, best_match, quality
5959

6060
.. autoclass:: AcceptCharsetInvalidHeader
6161
:members: parse, header_value, parsed, __init__, __add__, __bool__,
62-
__contains__, __iter__, __nonzero__, __radd__, __repr__, __str__,
62+
__contains__, __iter__, __radd__, __repr__, __str__,
6363
acceptable_offers, best_match, quality
6464

6565
.. autoclass:: AcceptEncoding
6666
:members: parse
6767

6868
.. autoclass:: AcceptEncodingValidHeader
6969
:members: parse, header_value, parsed, __init__, __add__, __bool__,
70-
__contains__, __iter__, __nonzero__, __radd__, __repr__, __str__,
70+
__contains__, __iter__, __radd__, __repr__, __str__,
7171
acceptable_offers, best_match, quality
7272

7373
.. autoclass:: AcceptEncodingNoHeader
7474
:members: parse, header_value, parsed, __init__, __add__, __bool__,
75-
__contains__, __iter__, __nonzero__, __radd__, __repr__, __str__,
75+
__contains__, __iter__, __radd__, __repr__, __str__,
7676
acceptable_offers, best_match, quality
7777

7878
.. autoclass:: AcceptEncodingInvalidHeader
7979
:members: parse, header_value, parsed, __init__, __add__, __bool__,
80-
__contains__, __iter__, __nonzero__, __radd__, __repr__, __str__,
80+
__contains__, __iter__, __radd__, __repr__, __str__,
8181
acceptable_offers, best_match, quality
8282

8383
.. autoclass:: AcceptLanguage

docs/wiki-example-code/example.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
)
5555

5656

57-
class WikiApp(object):
57+
class WikiApp:
5858
view_template = VIEW_TEMPLATE
5959
edit_template = EDIT_TEMPLATE
6060

@@ -67,7 +67,7 @@ def __call__(self, environ, start_response):
6767
page = self.get_page(req.path_info)
6868
try:
6969
try:
70-
meth = getattr(self, "action_%s_%s" % (action, req.method))
70+
meth = getattr(self, "action_{}_{}".format(action, req.method))
7171
except AttributeError:
7272
raise exc.HTTPBadRequest("No such action %r" % action)
7373
resp = meth(req, page)
@@ -120,7 +120,7 @@ def action_edit_GET(self, req, page):
120120
return Response(text)
121121

122122

123-
class Page(object):
123+
class Page:
124124
def __init__(self, filename):
125125
self.filename = filename
126126

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ requires = ["setuptools >= 41"]
33
build-backend = "setuptools.build_meta"
44

55
[tool.black]
6-
target-version = ['py36', 'py37', 'py38']
6+
target-version = ['py38', 'py39', 'py310', 'py311', 'py312']
77
exclude = '''
88
/(
99
\.git

rtd.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

setup.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,11 @@
3232
"Topic :: Internet :: WWW/HTTP :: WSGI",
3333
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
3434
"Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware",
35-
"Programming Language :: Python :: 3.7",
36-
"Programming Language :: Python :: 3.7",
3735
"Programming Language :: Python :: 3.8",
3836
"Programming Language :: Python :: 3.9",
3937
"Programming Language :: Python :: 3.10",
4038
"Programming Language :: Python :: 3.11",
39+
"Programming Language :: Python :: 3.12",
4140
"Programming Language :: Python :: Implementation :: CPython",
4241
"Programming Language :: Python :: Implementation :: PyPy",
4342
],
@@ -49,7 +48,7 @@
4948
license="MIT",
5049
packages=find_packages("src", exclude=["tests"]),
5150
package_dir={"": "src"},
52-
python_requires=">=3.7",
51+
python_requires=">=3.8",
5352
zip_safe=True,
5453
extras_require={"testing": testing_extras, "docs": docs_extras},
5554
)

src/webob/acceptparse.py

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -662,8 +662,6 @@ def __bool__(self):
662662

663663
return True
664664

665-
__nonzero__ = __bool__ # Python 2
666-
667665
def __contains__(self, offer):
668666
"""
669667
Return ``bool`` indicating whether `offer` is acceptable.
@@ -1282,8 +1280,6 @@ def __bool__(self):
12821280
"""
12831281
return False
12841282

1285-
__nonzero__ = __bool__ # Python 2
1286-
12871283
def __contains__(self, offer):
12881284
"""
12891285
Return ``bool`` indicating whether `offer` is acceptable.
@@ -1959,8 +1955,6 @@ def __bool__(self):
19591955

19601956
return True
19611957

1962-
__nonzero__ = __bool__ # Python 2
1963-
19641958
def __contains__(self, offer):
19651959
"""
19661960
Return ``bool`` indicating whether `offer` is acceptable.
@@ -2309,8 +2303,6 @@ def __bool__(self):
23092303
"""
23102304
return False
23112305

2312-
__nonzero__ = __bool__ # Python 2
2313-
23142306
def __contains__(self, offer):
23152307
"""
23162308
Return ``bool`` indicating whether `offer` is acceptable.
@@ -2969,8 +2961,6 @@ def __bool__(self):
29692961

29702962
return True
29712963

2972-
__nonzero__ = __bool__ # Python 2
2973-
29742964
def __contains__(self, offer):
29752965
"""
29762966
Return ``bool`` indicating whether `offer` is acceptable.
@@ -3352,8 +3342,6 @@ def __bool__(self):
33523342
"""
33533343
return False
33543344

3355-
__nonzero__ = __bool__ # Python 2
3356-
33573345
def __contains__(self, offer):
33583346
"""
33593347
Return ``bool`` indicating whether `offer` is acceptable.
@@ -3991,7 +3979,7 @@ def __add__(self, other):
39913979
instance=self, other=other
39923980
)
39933981

3994-
def __nonzero__(self):
3982+
def __bool__(self):
39953983
"""
39963984
Return whether ``self`` represents a valid ``Accept-Language`` header.
39973985
@@ -4004,8 +3992,6 @@ def __nonzero__(self):
40043992

40053993
return True
40063994

4007-
__bool__ = __nonzero__ # Python 3
4008-
40093995
def __contains__(self, offer):
40103996
"""
40113997
Return ``bool`` indicating whether `offer` is acceptable.
@@ -4838,7 +4824,7 @@ class _AcceptLanguageInvalidOrNoHeader(AcceptLanguage):
48384824
have much behaviour in common.
48394825
"""
48404826

4841-
def __nonzero__(self):
4827+
def __bool__(self):
48424828
"""
48434829
Return whether ``self`` represents a valid ``Accept-Language`` header.
48444830
@@ -4850,8 +4836,6 @@ def __nonzero__(self):
48504836
"""
48514837
return False
48524838

4853-
__bool__ = __nonzero__ # Python 3
4854-
48554839
def __contains__(self, offer):
48564840
"""
48574841
Return ``bool`` indicating whether `offer` is acceptable.

0 commit comments

Comments
 (0)