Skip to content

Commit

Permalink
Merge pull request #1971 from Amwam/feature/python38
Browse files Browse the repository at this point in the history
Python 3.8 runtime support
  • Loading branch information
mcrowson authored Feb 5, 2020
2 parents 746385d + 261d0a4 commit ea3fe6a
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 4 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ python:
- "2.7"
- "3.6"
- "3.7"
- "3.8"
dist: xenial
# command to install dependencies
cache:
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Framework :: Django',
'Framework :: Django :: 1.11',
'Framework :: Django :: 2.0',
Expand Down
10 changes: 9 additions & 1 deletion tests/test_app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
from cgi import parse_qs, escape
from zappa.asynchronous import task
try:
from urllib.parse import parse_qs
except ImportError:
from cgi import parse_qs

try:
from html import escape
except ImportError:
from cgi import escape


def hello_world(environ, start_response):
Expand Down
13 changes: 13 additions & 0 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,19 @@ def test_get_manylinux_python37(self):
self.assertTrue(os.path.isfile(path))
os.remove(path)

def test_get_manylinux_python38(self):
z = Zappa(runtime='python3.8')
self.assertIsNotNone(z.get_cached_manylinux_wheel('psycopg2', '2.7.6'))
self.assertIsNone(z.get_cached_manylinux_wheel('derp_no_such_thing', '0.0'))

# mock with a known manylinux wheel package so that code for downloading them gets invoked
mock_installed_packages = {'psycopg2': '2.7.6'}
with mock.patch('zappa.core.Zappa.get_installed_packages', return_value=mock_installed_packages):
z = Zappa(runtime='python3.8')
path = z.create_lambda_zip(handler_file=os.path.realpath(__file__))
self.assertTrue(os.path.isfile(path))
os.remove(path)

def test_should_use_lambda_packages(self):
z = Zappa(runtime='python2.7')

Expand Down
2 changes: 1 addition & 1 deletion zappa/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys

SUPPORTED_VERSIONS = [(2, 7), (3, 6), (3, 7)]
SUPPORTED_VERSIONS = [(2, 7), (3, 6), (3, 7), (3, 8)]

python_major_version = sys.version_info[0]
python_minor_version = sys.version_info[1]
Expand Down
2 changes: 1 addition & 1 deletion zappa/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ def splitpath(path):
# This is a special case!
# SQLite3 is part of the _system_ Python, not a package. Still, it lives in `lambda-packages`.
# Everybody on Python3 gets it!
if self.runtime in ("python3.6", "python3.7"):
if self.runtime in ("python3.6", "python3.7", "python3.8"):
print(" - sqlite==python3: Using precompiled lambda package")
self.extract_lambda_package('sqlite3', temp_project_path)

Expand Down
4 changes: 3 additions & 1 deletion zappa/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,10 @@ def get_runtime_from_python_version():
else:
if sys.version_info[1] <= 6:
return 'python3.6'
else:
elif sys.version_info[1] <= 7:
return 'python3.7'
else:
return 'python3.8'

##
# Async Tasks
Expand Down

0 comments on commit ea3fe6a

Please sign in to comment.