Skip to content

Commit

Permalink
Update dependencies (FastAPI, uvicorn, etc.) (#337)
Browse files Browse the repository at this point in the history
* update `generate_reqs` invoke task for latest pipenv
* fastapi 0.61 -> 0.63
* uvicorn 0.11.8 -> 0.13.4
* sentry, scout updates, etc.
* update requirements test
* update Sources enum
* linting fix (invalid-name)
* use Sources enum instead of string
* skip test_requirements if not python3.8
  • Loading branch information
Kilo59 committed Feb 27, 2021
1 parent 348628d commit 1c7e4ae
Show file tree
Hide file tree
Showing 7 changed files with 767 additions and 515 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Expand Up @@ -34,7 +34,7 @@ python-dateutil = "*"
requests = "*"
scout-apm = "*"
sentry-sdk = "*"
uvicorn = "*"
uvicorn = {extras = ["standard"],version = "*"}

[requires]
python_version = "3.8"
Expand Down
1,103 changes: 665 additions & 438 deletions Pipfile.lock

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions app/routers/v2.py
Expand Up @@ -14,13 +14,15 @@ class Sources(str, enum.Enum):
A source available for retrieving data.
"""

jhu = "jhu"
csbs = "csbs"
nyt = "nyt"
JHU = "jhu"
CSBS = "csbs"
NYT = "nyt"


@V2.get("/latest", response_model=LatestResponse)
async def get_latest(request: Request, source: Sources = "jhu"): # pylint: disable=unused-argument
async def get_latest(
request: Request, source: Sources = Sources.JHU
): # pylint: disable=unused-argument
"""
Getting latest amount of total confirmed cases, deaths, and recoveries.
"""
Expand Down Expand Up @@ -91,7 +93,7 @@ async def get_locations(
# pylint: disable=invalid-name
@V2.get("/locations/{id}", response_model=LocationResponse)
async def get_location_by_id(
request: Request, id: int, source: Sources = "jhu", timelines: bool = True
request: Request, id: int, source: Sources = Sources.JHU, timelines: bool = True
):
"""
Getting specific location by id.
Expand Down
81 changes: 43 additions & 38 deletions requirements-dev.txt
@@ -1,49 +1,54 @@
#
# These requirements were autogenerated by pipenv
# To regenerate from the project's Pipfile, run:
#
# pipenv lock --requirements --dev-only
#

-i https://pypi.org/simple
appdirs==1.4.4
astroid==2.4.2
async-asgi-testclient==1.4.4
astroid==2.5.0; python_version >= '3.6'
async-asgi-testclient==1.4.5
async-generator==1.10
asyncmock==0.4.2
attrs==20.2.0
bandit==1.6.2
attrs==20.3.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
bandit==1.7.0
black==19.10b0
certifi==2020.6.20
certifi==2020.12.5
chardet==3.0.4
click==7.1.2
coverage==5.3
coveralls==2.1.2
click==7.1.2; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
coverage==5.4; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4.0'
coveralls==3.0.0
docopt==0.6.2
gitdb==4.0.5
gitpython==3.1.8
gitdb==4.0.5; python_version >= '3.4'
gitpython==3.1.13; python_version >= '3.4'
idna==2.10
importlib-metadata==1.7.0 ; python_version < '3.8'
iniconfig==1.0.1
invoke==1.4.1
isort==5.5.2
lazy-object-proxy==1.4.3
importlib-metadata==3.7.0; python_version < '3.8'
iniconfig==1.1.1
invoke==1.5.0
isort==5.7.0
lazy-object-proxy==1.5.2; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
mccabe==0.6.1
mock==4.0.2
more-itertools==8.5.0
multidict==4.7.6
packaging==20.4
pathspec==0.8.0
pbr==5.5.0
pluggy==0.13.1
py==1.9.0
pylint==2.6.0
pyparsing==2.4.7
mock==4.0.3; python_version >= '3.6'
multidict==5.1.0; python_version >= '3.6'
packaging==20.9; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
pathspec==0.8.1
pbr==5.5.1; python_version >= '2.6'
pluggy==0.13.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
py==1.10.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
pylint==2.7.1
pyparsing==2.4.7; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'
pytest-asyncio==0.14.0
pytest-cov==2.10.1
pytest==6.0.2
pyyaml==5.3.1
regex==2020.7.14
requests==2.24.0
responses==0.12.0
six==1.15.0
smmap==3.0.4
stevedore==3.2.2
toml==0.10.1
typed-ast==1.4.1
urllib3[secure]==1.25.10 ; python_version >= '3.5'
pytest-cov==2.11.1
pytest==6.2.2
pyyaml==5.4.1
regex==2020.11.13
requests==2.25.1
responses==0.12.1
six==1.15.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
smmap==3.0.5; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
stevedore==3.3.0; python_version >= '3.6'
toml==0.10.2; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'
typed-ast==1.4.2
urllib3[secure]==1.26.3; python_version >= '3.5'
wrapt==1.12.1
zipp==3.1.0
72 changes: 41 additions & 31 deletions requirements.txt
@@ -1,41 +1,51 @@
#
# These requirements were autogenerated by pipenv
# To regenerate from the project's Pipfile, run:
#
# pipenv lock --requirements
#

-i https://pypi.org/simple
aiocache[redis]==0.11.1
aiofiles==0.5.0
aiohttp==3.6.2
aiofiles==0.6.0
aiohttp==3.7.4
aioredis==1.3.1
asgiref==3.2.10 ; python_version >= '3.5'
async-timeout==3.0.1
asgiref==3.3.1; python_version >= '3.5'
async-timeout==3.0.1; python_full_version >= '3.5.3'
asyncache==0.1.1
attrs==20.2.0
cachetools==4.1.1
certifi==2020.6.20
cffi==1.14.2
attrs==20.3.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
cachetools==4.2.1
certifi==2020.12.5
cffi==1.14.5
chardet==3.0.4
click==7.1.2
cryptography==3.1
dataclasses==0.6 ; python_version < '3.7'
fastapi==0.61.1
click==7.1.2; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
cryptography==3.4.6
dataclasses==0.6; python_version < '3.7'
fastapi==0.63.0
gunicorn==20.0.4
h11==0.9.0
hiredis==1.1.0
httptools==0.1.1 ; sys_platform != 'win32' and sys_platform != 'cygwin' and platform_python_implementation != 'PyPy'
idna-ssl==1.1.0 ; python_version < '3.7'
h11==0.12.0; python_version >= '3.6'
hiredis==1.1.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
httptools==0.1.1
idna-ssl==1.1.0; python_version < '3.7'
idna==2.10
multidict==4.7.6
psutil==5.7.2
pycparser==2.20
pydantic[dotenv]==1.6.1
pyopenssl==19.1.0
multidict==5.1.0; python_version >= '3.6'
psutil==5.8.0; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'
pycparser==2.20; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
pydantic[dotenv]==1.8
pyopenssl==20.0.1
python-dateutil==2.8.1
python-dotenv==0.14.0
requests==2.24.0
scout-apm==2.16.1
sentry-sdk==0.17.4
six==1.15.0
starlette==0.13.6
urllib3[secure]==1.25.10 ; python_version >= '3.5'
uvicorn==0.11.8
uvloop==0.14.0 ; sys_platform != 'win32' and sys_platform != 'cygwin' and platform_python_implementation != 'PyPy'
python-dotenv==0.15.0
pyyaml==5.4.1
requests==2.25.1
scout-apm==2.18.0
sentry-sdk==0.20.3
six==1.15.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
starlette==0.13.6; python_version >= '3.6'
typing-extensions==3.7.4.3
urllib3[secure]==1.26.3; python_version >= '3.5'
uvicorn[standard]==0.13.4
uvloop==0.15.2
watchgod==0.7
websockets==8.1
wrapt==1.12.1
yarl==1.5.1
yarl==1.6.3; python_version >= '3.6'
4 changes: 3 additions & 1 deletion tasks.py
Expand Up @@ -72,9 +72,11 @@ def test(ctx):
@invoke.task
def generate_reqs(ctx):
"""Generate requirements.txt"""
# NOTE: updated for pipenv 2020 release
# TODO: make backwards compatible
reqs = [
"pipenv lock -r > requirements.txt",
"pipenv lock -r --dev > requirements-dev.txt",
"pipenv lock -r --dev-only > requirements-dev.txt",
]
[ctx.run(req) for req in reqs]

Expand Down
8 changes: 7 additions & 1 deletion tests/test_cli.py
@@ -1,4 +1,9 @@
import subprocess
import sys

import pytest

PYTHON_VERSION = float(f"{sys.version_info.major}.{sys.version_info.minor}")


def test_invoke_list():
Expand All @@ -8,6 +13,7 @@ def test_invoke_list():
assert return_code == 0


@pytest.mark.skipif(reason="Minor marker differences", condition=PYTHON_VERSION != 3.8)
def test_requirements_txt():
"""Validate that requirements.txt and requirements-dev.txt
are up2date with Pipefile"""
Expand All @@ -25,7 +31,7 @@ def test_requirements_txt():
)

return_code_2 = subprocess.call(
"pipenv lock -r --dev \
"pipenv lock -r --dev-only \
> {}".format(
req_dev_test_file_path
),
Expand Down

0 comments on commit 1c7e4ae

Please sign in to comment.