Skip to content

Commit

Permalink
Merge pull request #459 from Pylons/add-py312
Browse files Browse the repository at this point in the history
add py3.12, drop py3.7, pyupgrade 3.8+
  • Loading branch information
digitalresistor authored Feb 24, 2024
2 parents 7073be5 + d3724c1 commit b06ee75
Show file tree
Hide file tree
Showing 21 changed files with 105 additions and 86 deletions.
29 changes: 22 additions & 7 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,51 @@ jobs:
strategy:
matrix:
py:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "pypy-3.8"
- "pypy-3.9"
- "pypy-3.10"
os:
- "ubuntu-latest"
- "windows-latest"
- "macos-latest"
architecture:
- x64
- x86

include:
- py: "pypy-3.8"
toxenv: "pypy38"
- py: "pypy-3.9"
toxenv: "pypy39"
- py: "pypy-3.10"
toxenv: "pypy310"
exclude:
# Linux and macOS don't have x86 python
- os: "ubuntu-latest"
architecture: x86
- os: "macos-latest"
architecture: x86
# PyPy on Windows is a no go
# Don't run all PyPy versions except latest on
# Windows/macOS. They are expensive to run.
- os: "windows-latest"
py: "pypy-3.8"
- os: "macos-latest"
py: "pypy-3.8"
- os: "windows-latest"
py: "pypy-3.9"
- os: "macos-latest"
py: "pypy-3.9"

name: "Python: ${{ matrix.py }}-${{ matrix.architecture }} on ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py }}
architecture: ${{ matrix.architecture }}
Expand All @@ -58,7 +73,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup python 3.8
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.8
architecture: x64
Expand All @@ -71,7 +86,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.8
architecture: x64
Expand All @@ -83,7 +98,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.8
architecture: x64
Expand Down
14 changes: 14 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# https://docs.readthedocs.io/en/stable/config-file/v2.html
version: 2
build:
os: ubuntu-22.04
tools:
python: '3.12'
sphinx:
configuration: docs/conf.py
python:
install:
- method: pip
path: .
extra_requirements:
- docs
7 changes: 5 additions & 2 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
Unreleased
----------

- Rename "master" git branch to "main"

Feature
~~~~~~~

- Rename "master" git branch to "main"

- Add support for Python 3.12.

- Add Request.remote_host, exposing REMOTE_HOST environment variable.

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

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

Experimental Features
~~~~~~~~~~~~~~~~~~~~~
Expand Down
5 changes: 3 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ graft tests
include README.rst
include CHANGES.txt HISTORY.txt
include contributing.md RELEASING.rst
include .coveragerc .flake8 pyproject.toml
include tox.ini appveyor.yml .travis.yml rtd.txt
include pyproject.toml
include .coveragerc .flake8 tox.ini
include .readthedocs.yaml

global-exclude __pycache__ *.py[cod]
global-exclude .DS_Store
18 changes: 9 additions & 9 deletions docs/api/webob.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,53 +31,53 @@ methods:

.. autoclass:: AcceptValidHeader
:members: parse, header_value, parsed, __init__, __add__, __bool__,
__contains__, __iter__, __nonzero__, __radd__, __repr__, __str__,
__contains__, __iter__, __radd__, __repr__, __str__,
accept_html, accepts_html, acceptable_offers, best_match, quality

.. autoclass:: AcceptNoHeader
:members: parse, header_value, parsed, __init__, __add__, __bool__,
__contains__, __iter__, __nonzero__, __radd__, __repr__, __str__,
__contains__, __iter__, __radd__, __repr__, __str__,
accept_html, accepts_html, acceptable_offers, best_match, quality

.. autoclass:: AcceptInvalidHeader
:members: parse, header_value, parsed, __init__, __add__, __bool__,
__contains__, __iter__, __nonzero__, __radd__, __repr__, __str__,
__contains__, __iter__, __radd__, __repr__, __str__,
accept_html, accepts_html, acceptable_offers, best_match, quality

.. autoclass:: AcceptCharset
:members: parse

.. autoclass:: AcceptCharsetValidHeader
:members: parse, header_value, parsed, __init__, __add__, __bool__,
__contains__, __iter__, __nonzero__, __radd__, __repr__, __str__,
__contains__, __iter__, __radd__, __repr__, __str__,
acceptable_offers, best_match, quality

.. autoclass:: AcceptCharsetNoHeader
:members: parse, header_value, parsed, __init__, __add__, __bool__,
__contains__, __iter__, __nonzero__, __radd__, __repr__, __str__,
__contains__, __iter__, __radd__, __repr__, __str__,
acceptable_offers, best_match, quality

.. autoclass:: AcceptCharsetInvalidHeader
:members: parse, header_value, parsed, __init__, __add__, __bool__,
__contains__, __iter__, __nonzero__, __radd__, __repr__, __str__,
__contains__, __iter__, __radd__, __repr__, __str__,
acceptable_offers, best_match, quality

.. autoclass:: AcceptEncoding
:members: parse

.. autoclass:: AcceptEncodingValidHeader
:members: parse, header_value, parsed, __init__, __add__, __bool__,
__contains__, __iter__, __nonzero__, __radd__, __repr__, __str__,
__contains__, __iter__, __radd__, __repr__, __str__,
acceptable_offers, best_match, quality

.. autoclass:: AcceptEncodingNoHeader
:members: parse, header_value, parsed, __init__, __add__, __bool__,
__contains__, __iter__, __nonzero__, __radd__, __repr__, __str__,
__contains__, __iter__, __radd__, __repr__, __str__,
acceptable_offers, best_match, quality

.. autoclass:: AcceptEncodingInvalidHeader
:members: parse, header_value, parsed, __init__, __add__, __bool__,
__contains__, __iter__, __nonzero__, __radd__, __repr__, __str__,
__contains__, __iter__, __radd__, __repr__, __str__,
acceptable_offers, best_match, quality

.. autoclass:: AcceptLanguage
Expand Down
6 changes: 3 additions & 3 deletions docs/wiki-example-code/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
)


class WikiApp(object):
class WikiApp:
view_template = VIEW_TEMPLATE
edit_template = EDIT_TEMPLATE

Expand All @@ -67,7 +67,7 @@ def __call__(self, environ, start_response):
page = self.get_page(req.path_info)
try:
try:
meth = getattr(self, "action_%s_%s" % (action, req.method))
meth = getattr(self, "action_{}_{}".format(action, req.method))
except AttributeError:
raise exc.HTTPBadRequest("No such action %r" % action)
resp = meth(req, page)
Expand Down Expand Up @@ -120,7 +120,7 @@ def action_edit_GET(self, req, page):
return Response(text)


class Page(object):
class Page:
def __init__(self, filename):
self.filename = filename

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["setuptools >= 41"]
build-backend = "setuptools.build_meta"

[tool.black]
target-version = ['py36', 'py37', 'py38']
target-version = ['py38', 'py39', 'py310', 'py311', 'py312']
exclude = '''
/(
\.git
Expand Down
1 change: 0 additions & 1 deletion rtd.txt

This file was deleted.

5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@
"Topic :: Internet :: WWW/HTTP :: WSGI",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"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",
],
Expand All @@ -49,7 +48,7 @@
license="MIT",
packages=find_packages("src", exclude=["tests"]),
package_dir={"": "src"},
python_requires=">=3.7",
python_requires=">=3.8",
zip_safe=True,
extras_require={"testing": testing_extras, "docs": docs_extras},
)
20 changes: 2 additions & 18 deletions src/webob/acceptparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,8 +662,6 @@ def __bool__(self):

return True

__nonzero__ = __bool__ # Python 2

def __contains__(self, offer):
"""
Return ``bool`` indicating whether `offer` is acceptable.
Expand Down Expand Up @@ -1282,8 +1280,6 @@ def __bool__(self):
"""
return False

__nonzero__ = __bool__ # Python 2

def __contains__(self, offer):
"""
Return ``bool`` indicating whether `offer` is acceptable.
Expand Down Expand Up @@ -1959,8 +1955,6 @@ def __bool__(self):

return True

__nonzero__ = __bool__ # Python 2

def __contains__(self, offer):
"""
Return ``bool`` indicating whether `offer` is acceptable.
Expand Down Expand Up @@ -2309,8 +2303,6 @@ def __bool__(self):
"""
return False

__nonzero__ = __bool__ # Python 2

def __contains__(self, offer):
"""
Return ``bool`` indicating whether `offer` is acceptable.
Expand Down Expand Up @@ -2969,8 +2961,6 @@ def __bool__(self):

return True

__nonzero__ = __bool__ # Python 2

def __contains__(self, offer):
"""
Return ``bool`` indicating whether `offer` is acceptable.
Expand Down Expand Up @@ -3352,8 +3342,6 @@ def __bool__(self):
"""
return False

__nonzero__ = __bool__ # Python 2

def __contains__(self, offer):
"""
Return ``bool`` indicating whether `offer` is acceptable.
Expand Down Expand Up @@ -3991,7 +3979,7 @@ def __add__(self, other):
instance=self, other=other
)

def __nonzero__(self):
def __bool__(self):
"""
Return whether ``self`` represents a valid ``Accept-Language`` header.
Expand All @@ -4004,8 +3992,6 @@ def __nonzero__(self):

return True

__bool__ = __nonzero__ # Python 3

def __contains__(self, offer):
"""
Return ``bool`` indicating whether `offer` is acceptable.
Expand Down Expand Up @@ -4838,7 +4824,7 @@ class _AcceptLanguageInvalidOrNoHeader(AcceptLanguage):
have much behaviour in common.
"""

def __nonzero__(self):
def __bool__(self):
"""
Return whether ``self`` represents a valid ``Accept-Language`` header.
Expand All @@ -4850,8 +4836,6 @@ def __nonzero__(self):
"""
return False

__bool__ = __nonzero__ # Python 3

def __contains__(self, offer):
"""
Return ``bool`` indicating whether `offer` is acceptable.
Expand Down
1 change: 0 additions & 1 deletion src/webob/byterange.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ def parse(cls, header):


class ContentRange:

"""
Represents the Content-Range header
Expand Down
2 changes: 1 addition & 1 deletion src/webob/cachecontrol.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Represents the Cache-Control header
"""

import re


Expand Down Expand Up @@ -140,7 +141,6 @@ def __delete__(self, obj):


class CacheControl:

"""
Represents the Cache-Control header.
Expand Down
2 changes: 1 addition & 1 deletion src/webob/datetime_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def parse_date_delta(value):


def serialize_date_delta(value):
if isinstance(value, (float, int, int)):
if isinstance(value, (float, int)):
return str(int(value))
else:
return serialize_date(value)
Loading

0 comments on commit b06ee75

Please sign in to comment.