Skip to content

Commit

Permalink
Merge pull request #1274 from kalaspuff/feature/python-38
Browse files Browse the repository at this point in the history
Python 3.8 support
  • Loading branch information
kalaspuff authored Jun 16, 2020
2 parents 39b368a + f95d8eb commit a26ef1d
Show file tree
Hide file tree
Showing 99 changed files with 520 additions and 241 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ coverage.xml
.hypothesis/
.pytest_cache

# Temporary
tmp/

# Translations
*.mo
*.pot
Expand Down
11 changes: 3 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
language: python
sudo: required
python:
- 3.5.3
- 3.5.5
- 3.6.1
- 3.6.2
- 3.6.3
- 3.6.4
- 3.6.5
- 3.6.6
- 3.7.7
- 3.8.3
services:
- rabbitmq
install:
- travis_retry pip install -e .
- travis_retry pip install -Ur requirements.txt
- pip freeze
script:
- pycodestyle --ignore E501 --exclude proto_build .
- pycodestyle --ignore E203,W503,E501 --exclude proto_build,build,tmp .
- travis_retry py.test --cov=./ tests/
- tomodachi run tests/run_example_service.py
- python tomodachi.py -v
Expand Down
21 changes: 21 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
Changes
=======

0.17.0 (2020-06-16)
-------------------
- Proper support for Python 3.8. Now correctly handles
`CancelledError` exceptions that previously sent a lot of
unwanted output on service shutdown or restart.

- Updated dependencies across the board, utilizing
package versions that supports Python 3.8.

- Dropped support for Python 3.5.

- Now gracefully handles shutdown for HTTP based services,
by awaiting active requests and giving them time to finish.
By default the ongoing HTTP requests will have 30 seconds to
complete their work, which can also be configured via
``options.http.termination_grace_period_seconds``.

- Taking steps into making the codebase following more modern
patterns. Additional updates to be followed in a later release.


0.16.6 (2020-02-25)
-------------------
- Removes the dependency on ``ujson``.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ uninstall:
pip uninstall -y tomodachi

lint:
pycodestyle --ignore E501 --exclude proto_build,build .
pycodestyle --ignore E501 --exclude proto_build,build,tmp .
mypy ./
@echo "ok"

Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -366,14 +366,14 @@ If the decorator would return anything else than ``True`` or ``None`` (or not sp
Requirements 👍
---------------
* Python_ (``3.5.3+``, ``3.6+``, ``3.7+``)
* Python_ (``3.6+``, ``3.7+``, ``3.8+``)
* aiohttp_
* aiobotocore_
* aioamqp_
* uvloop_

.. _Python: https://www.python.org
.. _asyncio: http://docs.python.org/3.5/library/asyncio.html
.. _asyncio: http://docs.python.org/3.8/library/asyncio.html
.. _aiohttp: https://github.com/aio-libs/aiohttp
.. _aiobotocore: https://github.com/aio-libs/aiobotocore
.. _aioamqp: https://github.com/Polyconseil/aioamqp
Expand Down
3 changes: 2 additions & 1 deletion examples/basic_examples/amqp_middleware_service.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
from typing import Any, Callable, Dict

import tomodachi
from typing import Any, Dict, Callable
from tomodachi import amqp, amqp_publish
from tomodachi.discovery import DummyRegistry
from tomodachi.protocol import JsonBase
Expand Down
3 changes: 2 additions & 1 deletion examples/basic_examples/amqp_service.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import tomodachi
from typing import Any, Dict

import tomodachi
from tomodachi import amqp, amqp_publish
from tomodachi.discovery import DummyRegistry
from tomodachi.protocol import JsonBase
Expand Down
3 changes: 2 additions & 1 deletion examples/basic_examples/aws_sns_registration_service.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import tomodachi
from typing import Dict

import tomodachi
from tomodachi import aws_sns_sqs
from tomodachi.protocol import JsonBase

Expand Down
3 changes: 2 additions & 1 deletion examples/basic_examples/aws_sns_sqs_middleware_service.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
from typing import Any, Callable, Dict

import tomodachi
from typing import Any, Dict, Callable
from tomodachi import aws_sns_sqs, aws_sns_sqs_publish
from tomodachi.discovery import AWSSNSRegistration
from tomodachi.protocol import JsonBase
Expand Down
3 changes: 2 additions & 1 deletion examples/basic_examples/aws_sns_sqs_service.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import tomodachi
from typing import Any, Dict

import tomodachi
from tomodachi import aws_sns_sqs, aws_sns_sqs_publish
from tomodachi.discovery import AWSSNSRegistration
from tomodachi.protocol import JsonBase
Expand Down
8 changes: 5 additions & 3 deletions examples/basic_examples/http_auth_service.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import os
import asyncio
import tomodachi
import os
import uuid
from typing import Any

from aiohttp import web
from tomodachi import http, HttpResponse

import tomodachi
from tomodachi import HttpResponse, http


@tomodachi.decorator
Expand Down
10 changes: 6 additions & 4 deletions examples/basic_examples/http_middleware_service.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import os
import asyncio
import tomodachi
from typing import Tuple, Callable, Union, Any, Dict
import os
from typing import Any, Callable, Dict, Tuple, Union

from aiohttp import web
from tomodachi import http, http_error, http_static, websocket, HttpResponse

import tomodachi
from tomodachi import HttpResponse, http, http_error, http_static, websocket
from tomodachi.discovery import DummyRegistry


Expand Down
10 changes: 6 additions & 4 deletions examples/basic_examples/http_simple_service.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import os
import asyncio
import tomodachi
from typing import Tuple, Callable, Union
import os
from typing import Callable, Tuple, Union

from aiohttp import web
from tomodachi import http, http_error, http_static, websocket, HttpResponse

import tomodachi
from tomodachi import HttpResponse, http, http_error, http_static, websocket
from tomodachi.discovery import DummyRegistry


Expand Down
3 changes: 2 additions & 1 deletion examples/basic_examples/scheduler_example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os

import tomodachi
from tomodachi import schedule, minutely, hourly
from tomodachi import hourly, minutely, schedule


@tomodachi.service
Expand Down
12 changes: 7 additions & 5 deletions examples/basic_examples/websockets/websocket_service.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import os
import asyncio
import tomodachi
import os
import pathlib
import uuid
from aiohttp.web_fileresponse import FileResponse
from typing import Tuple, Callable, Union
from typing import Callable, Tuple, Union

from aiohttp import web
from tomodachi import http_error, http, http_static, websocket
from aiohttp.web_fileresponse import FileResponse

import tomodachi
from tomodachi import http, http_error, http_static, websocket


@tomodachi.service
Expand Down
2 changes: 1 addition & 1 deletion examples/docker_example/http_service/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
tomodachi==0.16.5
tomodachi==0.17.0
3 changes: 2 additions & 1 deletion examples/pubsub_example/service_a.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import tomodachi
from typing import Any

import tomodachi
from tomodachi import aws_sns_sqs, aws_sns_sqs_publish
from tomodachi.protocol import JsonBase

Expand Down
3 changes: 2 additions & 1 deletion examples/pubsub_example/service_b.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import tomodachi
from typing import Any

import tomodachi
from tomodachi import aws_sns_sqs
from tomodachi.protocol import JsonBase

Expand Down
5 changes: 3 additions & 2 deletions examples/pubsub_example/service_send_message.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import tomodachi
import uuid
from typing import Any
from tomodachi import schedule, aws_sns_sqs_publish

import tomodachi
from tomodachi import aws_sns_sqs_publish, schedule
from tomodachi.protocol import JsonBase


Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[tool.black]
line-length = 120
59 changes: 30 additions & 29 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,38 +1,39 @@
pycparser==2.19
aioamqp==0.13.0
aiobotocore==0.10.3
aiobotocore==0.12.0
aiodns==2.0.0
aiohttp==3.5.4
aiohttp==3.6.2
aioitertools==0.7.0
async-generator==1.10
async-timeout==3.0.1
attrs==19.1.0
botocore==1.12.189
cchardet==2.1.4
attrs==19.3.0
botocore==1.15.15
cchardet==2.1.6
chardet==3.0.4
codecov==2.0.15
colorama==0.4.1
coverage==4.5.4
codecov==2.1.7
colorama==0.4.3
coverage==5.1
docutils==0.15.2
execnet==1.7.1
jmespath==0.9.4
multidict==4.5.2
mypy==0.720
packaging==19.1
protobuf==3.9.1
pycares==3.0.0
pycodestyle==2.5.0
py==1.8.0
pyparsing==2.4.2
pytest==5.1.1
pytest-cov==2.7.1
pytest-forked==1.0.2
pytest-xdist==1.29.0
python-dateutil==2.8.0
pytz==2019.2
readme-renderer==24.0
requests==2.22.0
six==1.12.0
jmespath==0.10.0
multidict==4.7.6
mypy==0.780
packaging==20.4
protobuf==3.12.2
pycares==3.1.1
pycodestyle==2.6.0
py==1.8.2
pyparsing==2.4.7
pytest==5.4.3
pytest-cov==2.10.0
pytest-forked==1.1.3
pytest-xdist==1.32.0
python-dateutil==2.8.1
pytz==2020.1
readme-renderer==26.0
requests==2.23.0
six==1.15.0
typing_extensions==3.7.4
tzlocal==2.0.0
uvloop==0.13.0
yarl==1.3.0
tzlocal==2.1
uvloop==0.14.0
yarl==1.4.2
15 changes: 8 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

install_requires = [
'pycparser>=2.18',
'aioamqp>=0.10.0, <0.14.0',
'aioamqp>=0.10.0, <0.15.0',
'uvloop>=0.8.1',
'aiobotocore>=0.6.0, <0.11.0',
'aiobotocore>=0.6.0, <=0.12.0',
'tzlocal>=1.4',
'aiohttp>=3.0.5, <3.6.0',
'yarl>=1.1.0',
Expand All @@ -19,8 +19,8 @@

PY_VER = sys.version_info

if not PY_VER >= (3, 5, 3):
raise RuntimeError("tomodachi doesn't support Python earlier than 3.5.3")
if not PY_VER >= (3, 6, 1):
raise RuntimeError("tomodachi doesn't support Python earlier than 3.6.1")


def read(f: str) -> str:
Expand All @@ -32,13 +32,14 @@ def read(f: str) -> str:
'Intended Audience :: System Administrators',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'License :: OSI Approved :: MIT License',
'Development Status :: 3 - Alpha',
'Development Status :: 4 - Beta',
'Topic :: Software Development :: Libraries :: Application Frameworks',
'Topic :: Software Development :: Libraries :: Python Modules'
'Topic :: Software Development :: Libraries :: Python Modules',
'Typing :: Typed'
]

setup(name='tomodachi',
Expand Down
5 changes: 3 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import uvloop
import asyncio
import pytest
from typing import Generator

import pytest
import uvloop


@pytest.yield_fixture(scope='module')
def loop() -> Generator:
Expand Down
1 change: 1 addition & 0 deletions tests/run_example_service.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import asyncio
import os
import signal

import tomodachi
from tomodachi.discovery.dummy_registry import DummyRegistry
from tomodachi.protocol.json_base import JsonBase
Expand Down
Loading

0 comments on commit a26ef1d

Please sign in to comment.