Skip to content

Commit

Permalink
Remove Python 3.6 support
Browse files Browse the repository at this point in the history
  • Loading branch information
ahopkins committed Feb 21, 2021
1 parent 8f8c00a commit 37f0a51
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 46 deletions.
20 changes: 0 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ cache:
- $HOME/.cache/pip
matrix:
include:
- env: TOX_ENV=py36
python: 3.6
name: "Python 3.6 with Extensions"
- env: TOX_ENV=py36-no-ext
python: 3.6
name: "Python 3.6 without Extensions"
- env: TOX_ENV=py37
python: 3.7
dist: xenial
Expand Down Expand Up @@ -41,9 +35,6 @@ matrix:
dist: bionic
sudo: true
name: "Python 3.9 without Extensions"
- env: TOX_ENV=type-checking
python: 3.6
name: "Python 3.6 Type checks"
- env: TOX_ENV=type-checking
python: 3.7
name: "Python 3.7 Type checks"
Expand All @@ -54,17 +45,6 @@ matrix:
python: 3.9
dist: bionic
name: "Python 3.9 Type checks"
- env: TOX_ENV=lint
python: 3.6
name: "Python 3.6 Linter checks"
- env: TOX_ENV=check
python: 3.6
name: "Python 3.6 Package checks"
- env: TOX_ENV=security
python: 3.6
dist: xenial
sudo: true
name: "Python 3.6 Bandit security scan"
- env: TOX_ENV=security
python: 3.7
dist: xenial
Expand Down
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ And, we can verify it is working: ``curl localhost:8000 -i``
**Now, let's go build something fast!**

Minimum Python version is 3.7. If you need Python 3.6 support, please use v20.12LTS.

Documentation
-------------
Expand Down
6 changes: 2 additions & 4 deletions sanic/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import secrets
import socket
import stat
import sys

from asyncio import CancelledError
from functools import partial
Expand Down Expand Up @@ -125,7 +124,6 @@ def __init__(
):
asyncio.set_event_loop(loop)
self.loop = loop
deprecated_loop = self.loop if sys.version_info < (3, 7) else None
self.app = app
self.url = None
self.transport = None
Expand All @@ -147,8 +145,8 @@ def __init__(
self.state = state if state else {}
if "requests_count" not in self.state:
self.state["requests_count"] = 0
self._data_received = asyncio.Event(loop=deprecated_loop)
self._can_write = asyncio.Event(loop=deprecated_loop)
self._data_received = asyncio.Event()
self._can_write = asyncio.Event()
self._can_write.set()
self._exception = None
self._unix = unix
Expand Down
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,11 @@ def open_local(paths, mode="r", encoding="utf8"):
"packages": ["sanic"],
"package_data": {"sanic": ["py.typed"]},
"platforms": "any",
"python_requires": ">=3.6",
"python_requires": ">=3.7",
"classifiers": [
"Development Status :: 4 - Beta",
"Environment :: Web Environment",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
Expand All @@ -81,7 +80,7 @@ def open_local(paths, mode="r", encoding="utf8"):
'; sys_platform != "win32" ' 'and implementation_name == "cpython"'
)
ujson = "ujson>=1.35" + env_dependency
uvloop = "uvloop>=0.5.3,<0.15.0" + env_dependency
uvloop = "uvloop>=0.5.3" + env_dependency

requirements = [
"sanic-routing",
Expand Down
9 changes: 0 additions & 9 deletions tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ async def handler(request):
assert response.text == "pass"


@pytest.mark.skipif(
sys.version_info < (3, 7), reason="requires python3.7 or higher"
)
def test_create_asyncio_server(app):
if not uvloop_installed():
loop = asyncio.get_event_loop()
Expand All @@ -44,9 +41,6 @@ def test_create_asyncio_server(app):
assert srv.is_serving() is True


@pytest.mark.skipif(
sys.version_info < (3, 7), reason="requires python3.7 or higher"
)
def test_asyncio_server_no_start_serving(app):
if not uvloop_installed():
loop = asyncio.get_event_loop()
Expand All @@ -59,9 +53,6 @@ def test_asyncio_server_no_start_serving(app):
assert srv.is_serving() is False


@pytest.mark.skipif(
sys.version_info < (3, 7), reason="requires python3.7 or higher"
)
def test_asyncio_server_start_serving(app):
if not uvloop_installed():
loop = asyncio.get_event_loop()
Expand Down
12 changes: 2 additions & 10 deletions tests/test_asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,7 @@ def install_signal_handlers(self):
with pytest.warns(UserWarning):
server.run()

all_tasks = (
asyncio.Task.all_tasks()
if sys.version_info < (3, 7)
else asyncio.all_tasks(asyncio.get_event_loop())
)
all_tasks = asyncio.all_tasks(asyncio.get_event_loop())
for task in all_tasks:
task.cancel()

Expand Down Expand Up @@ -140,11 +136,7 @@ def install_signal_handlers(self):
with pytest.warns(UserWarning):
server.run()

all_tasks = (
asyncio.Task.all_tasks()
if sys.version_info < (3, 7)
else asyncio.all_tasks(asyncio.get_event_loop())
)
all_tasks = asyncio.all_tasks(asyncio.get_event_loop())
for task in all_tasks:
task.cancel()

Expand Down

0 comments on commit 37f0a51

Please sign in to comment.