Skip to content

Commit 205795d

Browse files
authored
Prepare for v23.6 release (#2797)
1 parent 9cbe1fb commit 205795d

File tree

10 files changed

+91
-36
lines changed

10 files changed

+91
-36
lines changed

.github/workflows/publish-package.yml

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,39 @@
1-
name: Publish Artifacts
1+
name: Upload Python Package
2+
23
on:
34
release:
45
types: [created]
5-
6+
workflow_dispatch:
67
jobs:
7-
publishPythonPackage:
8-
name: Publishing Sanic Release Artifacts
8+
build-n-publish:
9+
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
910
runs-on: ubuntu-latest
10-
11-
strategy:
12-
fail-fast: true
13-
matrix:
14-
python-version: ["3.10"]
15-
1611
steps:
17-
- name: Checkout Repository
18-
uses: actions/checkout@v2
19-
20-
- name: Publish Python Package
21-
uses: harshanarayana/custom-actions@main
22-
with:
23-
python-version: ${{ matrix.python-version }}
24-
package-infra-name: "twine"
25-
pypi-user: __token__
26-
pypi-access-token: ${{ secrets.PYPI_ACCESS_TOKEN }}
27-
action: "package-publish"
28-
pypi-verify-metadata: "true"
12+
- uses: actions/checkout@v3
13+
- name: Set up Python
14+
uses: actions/setup-python@v4
15+
with:
16+
python-version: "3.x"
17+
- name: Install pypa/build
18+
run: >-
19+
python3 -m
20+
pip install
21+
build
22+
--user
23+
- name: Build a binary wheel and a source tarball
24+
run: >-
25+
python3 -m
26+
build
27+
--sdist
28+
--wheel
29+
--outdir dist/
30+
.
31+
- name: Publish distribution 📦 to Test PyPI
32+
uses: pypa/gh-action-pypi-publish@release/v1
33+
with:
34+
password: ${{ secrets.SANIC_TEST_PYPI_API_TOKEN }}
35+
repository-url: https://test.pypi.org/legacy/
36+
- name: Publish distribution 📦 to PyPI
37+
uses: pypa/gh-action-pypi-publish@release/v1
38+
with:
39+
password: ${{ secrets.SANIC_PYPI_API_TOKEN }}

docs/sanic/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
| 🔷 In support release
66
|
77
8+
.. mdinclude:: ./releases/23/23.6.md
89
.. mdinclude:: ./releases/23/23.3.md
910
.. mdinclude:: ./releases/22/22.12.md
1011
.. mdinclude:: ./releases/22/22.9.md

docs/sanic/releases/23/23.3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Version 23.3.0 🔶
1+
## Version 23.3.0
22

33
### Features
44
- [#2545](https://github.com/sanic-org/sanic/pull/2545) Standardize init of exceptions for more consistent control of HTTP responses using exceptions

docs/sanic/releases/23/23.6.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
## Version 23.6.0 🔶
2+
3+
### Features
4+
- [#2670](https://github.com/sanic-org/sanic/pull/2670) Increase `KEEP_ALIVE_TIMEOUT` default to 120 seconds
5+
- [#2716](https://github.com/sanic-org/sanic/pull/2716) Adding allow route overwrite option in blueprint
6+
- [#2724](https://github.com/sanic-org/sanic/pull/2724) and [#2792](https://github.com/sanic-org/sanic/pull/2792) Add a new exception signal for ALL exceptions raised anywhere in application
7+
- [#2727](https://github.com/sanic-org/sanic/pull/2727) Add name prefixing to BP groups
8+
- [#2754](https://github.com/sanic-org/sanic/pull/2754) Update request type on middleware types
9+
- [#2770](https://github.com/sanic-org/sanic/pull/2770) Better exception message on startup time application induced import error
10+
- [#2776](https://github.com/sanic-org/sanic/pull/2776) Set multiprocessing start method early
11+
- [#2785](https://github.com/sanic-org/sanic/pull/2785) Add custom typing to config and ctx objects
12+
- [#2790](https://github.com/sanic-org/sanic/pull/2790) Add `request.client_ip`
13+
14+
### Bugfixes
15+
- [#2728](https://github.com/sanic-org/sanic/pull/2728) Fix traversals for intended results
16+
- [#2729](https://github.com/sanic-org/sanic/pull/2729) Handle case when headers argument of ResponseStream constructor is None
17+
- [#2737](https://github.com/sanic-org/sanic/pull/2737) Fix type annotation for `JSONREsponse` default content type
18+
- [#2740](https://github.com/sanic-org/sanic/pull/2740) Use Sanic's serializer for JSON responses in the Inspector
19+
- [#2760](https://github.com/sanic-org/sanic/pull/2760) Support for `Request.get_current` in ASGI mode
20+
- [#2773](https://github.com/sanic-org/sanic/pull/2773) Alow Blueprint routes to explicitly define error_format
21+
- [#2774](https://github.com/sanic-org/sanic/pull/2774) Resolve headers on different renderers
22+
- [#2782](https://github.com/sanic-org/sanic/pull/2782) Resolve pypy compatibility issues
23+
24+
### Deprecations and Removals
25+
- [#2777](https://github.com/sanic-org/sanic/pull/2777) Remove Python 3.7 support
26+
27+
### Developer infrastructure
28+
- [#2766](https://github.com/sanic-org/sanic/pull/2766) Unpin setuptools version
29+
- [#2779](https://github.com/sanic-org/sanic/pull/2779) Run keep alive tests in loop to get available port
30+
31+
### Improved Documentation
32+
- [#2741](https://github.com/sanic-org/sanic/pull/2741) Better documentation examples about running Sanic
33+
From that list, the items to highlight in the release notes:

sanic/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "23.3.1"
1+
__version__ = "23.6.0"

sanic/mixins/exceptions.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,15 @@ def decorator(handler):
3838
return handler
3939

4040
return decorator
41+
42+
def all_exceptions(self, handler):
43+
"""
44+
This method enables the process of creating a global exception
45+
handler for the current blueprint under question.
46+
47+
:param handler: A coroutine function to handle exceptions
48+
49+
:return a decorated method to handle global exceptions for any
50+
route registered under this blueprint.
51+
"""
52+
return self.exception(Exception)(handler)

sanic/mixins/signals.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from sanic.base.meta import SanicMeta
55
from sanic.models.futures import FutureSignal
66
from sanic.models.handler_types import SignalHandler
7-
from sanic.signals import Signal
7+
from sanic.signals import Event, Signal
88
from sanic.types import HashableDict
99

1010

@@ -80,3 +80,9 @@ async def noop():
8080

8181
def event(self, event: str):
8282
raise NotImplementedError
83+
84+
def catch_exception(self, handler):
85+
async def signal_handler(exception: Exception):
86+
await handler(self, exception)
87+
88+
self.signal(Event.SERVER_LIFECYCLE_EXCEPTION)(signal_handler)

sanic/signals.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,6 @@ def add( # type: ignore
230230
if not trigger:
231231
event = ".".join([*parts[:2], "<__trigger__>"])
232232

233-
try:
234-
# Attaching __requirements__ and __trigger__ to the handler
235-
# is deprecated and will be removed in v23.6.
236-
handler.__requirements__ = condition # type: ignore
237-
handler.__trigger__ = trigger # type: ignore
238-
except AttributeError:
239-
pass
240-
241233
signal = super().add(
242234
event,
243235
handler,

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def str_to_bool(val: str) -> bool:
103103
uvloop = "uvloop>=0.15.0" + env_dependency
104104
types_ujson = "types-ujson" + env_dependency
105105
requirements = [
106-
"sanic-routing>=22.8.0",
106+
"sanic-routing>=23.6.0",
107107
"httptools>=0.0.10",
108108
uvloop,
109109
ujson,
@@ -116,7 +116,7 @@ def str_to_bool(val: str) -> bool:
116116
]
117117

118118
tests_require = [
119-
"sanic-testing>=23.3.0",
119+
"sanic-testing>=23.6.0",
120120
"pytest==7.1.*",
121121
"coverage",
122122
"beautifulsoup4",

tests/test_redirect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ async def init_handler(request, test):
126126

127127
@app.route("/api/v2/test/<test>/", unquote=True)
128128
async def target_handler(request, test):
129-
assert test == test_str
129+
assert test == quote(test_str)
130130
return text("OK")
131131

132132
_, response = app.test_client.get(f"/api/v1/test/{use_in_uri}/")

0 commit comments

Comments
 (0)