Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .changes/1.29.0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"schema-version": "1.0",
"changes": [
{
"type": "feature",
"category": "Python",
"description": "Add support for Python 3.10 (#2037)"
},
{
"type": "enhancement",
"category": "Pip",
"description": "Bump pip version range to latest version <23.2 (#2034)"
}
]
}
1 change: 0 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ updates:
allow:
- dependency-name: pip
- dependency-name: click
- dependency-name: attrs
4 changes: 2 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: [3.8, 3.9]
python-version: [3.8, 3.9, '3.10']
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9, '3.10']
cdk-version: [cdk, cdkv2]
steps:
- uses: actions/checkout@v2
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
CHANGELOG
=========

1.29.0
======

* feature:Python:Add support for Python 3.10 (#2037)
* enhancement:Pip:Bump pip version range to latest version <23.2 (#2034)


1.28.0
======

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Quickstart
In this tutorial, you'll use the ``chalice`` command line utility
to create and deploy a basic REST API. This quickstart uses Python 3.7,
but AWS Chalice supports all versions of python supported by AWS Lambda,
which includes python3.6, python3.7, python3.8, python3.9.
which includes python3.6, python3.7, python3.8, python3.9, python3.10.
You can find the latest versions of python on the
`Python download page <https://www.python.org/downloads/>`_.

Expand Down
2 changes: 1 addition & 1 deletion chalice/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from collections.abc import MutableMapping


__version__: str = '1.28.0'
__version__: str = '1.29.0'

from typing import List, Dict, Any, Optional, Sequence, Union, Callable, Set, \
Iterator, TYPE_CHECKING, Tuple
Expand Down
4 changes: 3 additions & 1 deletion chalice/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ def lambda_python_version(self) -> str:
return 'python3.7'
elif (major, minor) <= (3, 8):
return 'python3.8'
return 'python3.9'
elif (major, minor) <= (3, 9):
return 'python3.9'
return 'python3.10'

@property
def log_retention_in_days(self) -> int:
Expand Down
2 changes: 2 additions & 0 deletions chalice/deploy/packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class BaseLambdaDeploymentPackager(object):
'python3.7': 'cp37m',
'python3.8': 'cp38',
'python3.9': 'cp39',
'python3.10': 'cp310',
}

def __init__(
Expand Down Expand Up @@ -497,6 +498,7 @@ class DependencyBuilder(object):
'cp36m': (2, 17),
'cp37m': (2, 17),
'cp38': (2, 26),
'cp310': (2, 26)
}
# Fallback version if we're on an unknown python version
# not in _RUNTIME_GLIBC.
Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@
# built documents.
#
# The short X.Y version.
version = u'1.28'
version = u'1.29'
# The full version, including alpha/beta/rc tags.
release = u'1.28.0'
release = u'1.29.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def recursive_include(relative_dir):
'typing==3.6.4;python_version<"3.7"',
'typing-extensions>=4.0.0,<5.0.0',
'six>=1.10.0,<2.0.0',
'pip>=9,<23.1',
'pip>=9,<23.2',
'jmespath>=0.9.3,<2.0.0',
'pyyaml>=5.3.1,<7.0.0',
'inquirer>=2.7.0,<3.0.0',
Expand All @@ -35,7 +35,7 @@ def recursive_include(relative_dir):

setup(
name='chalice',
version='1.28.0',
version='1.29.0',
description="Microframework",
long_description=README,
author="James Saryerwinnie",
Expand All @@ -44,7 +44,7 @@ def recursive_include(relative_dir):
packages=find_packages(exclude=['tests', 'tests.*']),
install_requires=install_requires,
extras_require={
'event-file-poller': ['watchdog==0.9.0'],
'event-file-poller': ['watchdog==2.3.1'],
'cdk': [
'aws_cdk.aws_iam>=1.85.0,<2.0',
'aws_cdk.aws-s3-assets>=1.85.0,<2.0',
Expand Down Expand Up @@ -74,5 +74,6 @@ def recursive_include(relative_dir):
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
],
)
2 changes: 2 additions & 0 deletions tests/functional/cli/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,8 @@ def test_error_when_no_deployed_record(runner, mock_cli_factory):
reason="Cannot generate pipeline for python3.8.")
@pytest.mark.skipif(sys.version_info[:2] == (3, 9),
reason="Cannot generate pipeline for python3.9.")
@pytest.mark.skipif(sys.version_info[:2] == (3, 10),
reason="Cannot generate pipeline for python3.10.")
def test_can_generate_pipeline_for_all(runner):
with runner.isolated_filesystem():
newproj.create_new_project_skeleton('testproject')
Expand Down
135 changes: 103 additions & 32 deletions tests/integration/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,95 @@
from chalice.deploy.packager import NoSuchPackageError


PY_VERSION = sys.version_info[:2]
VERSION_CUTOFF = (3, 9)
# We're being cautious here, but we want to fix the package versions we
# try to install on older versions of python.
# If the python version being tested is less than the VERSION_CUTOFF of 3.9,
# then we'll install the `legacy_version` in the packages below. This is to
# ensure we don't regress on being able to package older package versions on
# older versions on python. Any python version above the VERSION_CUTOFF will
# install the `version` identifier. That way newer versions of python won't
# need to update this list as long as a package can still be installed on
# 3.10 or higher.
PACKAGES_TO_TEST = {
'pandas': {
'version': '1.5.3',
'legacy_version': '1.1.5',
'contents': [
'pandas/_libs/__init__.py',
'pandas/io/sas/_sas.cpython-*-x86_64-linux-gnu.so'
],
},
'SQLAlchemy': {
'version': '1.4.47',
'legacy_version': '1.3.20',
'contents': [
'sqlalchemy/__init__.py',
'sqlalchemy/cresultproxy.cpython-*-x86_64-linux-gnu.so'
],
},
'numpy': {
'version': '1.21.6',
'legacy_version': '1.19.4',
'contents': [
'numpy/__init__.py',
'numpy/core/_struct_ufunc_tests.cpython-*-x86_64-linux-gnu.so'
],
},
'cryptography': {
'version': '3.3.1',
'legacy_version': '3.3.1',
'contents': [
'cryptography/__init__.py',
'cryptography/hazmat/bindings/_openssl.abi3.so'
],
},
'Jinja2': {
'version': '2.11.2',
'legacy_version': '2.11.2',
'contents': ['jinja2/__init__.py'],
},
'Mako': {
'version': '1.1.3',
'legacy_version': '1.1.3',
'contents': ['mako/__init__.py'],
},
'MarkupSafe': {
'version': '1.1.1',
'legacy_version': '1.1.1',
'contents': ['markupsafe/__init__.py'],
},
'scipy': {
'version': '1.7.3',
'legacy_version': '1.5.4',
'contents': [
'scipy/__init__.py',
'scipy/cluster/_hierarchy.cpython-*-x86_64-linux-gnu.so'
],
},
'cffi': {
'version': '1.15.1',
'legacy_version': '1.14.5',
'contents': ['_cffi_backend.cpython-*-x86_64-linux-gnu.so'],
},
'pygit2': {
'version': '1.10.1',
'legacy_version': '1.5.0',
'contents': ['pygit2/_pygit2.cpython-*-x86_64-linux-gnu.so'],
},
'pyrsistent': {
'version': '0.17.3',
'legacy_version': '0.17.3',
'contents': ['pyrsistent/__init__.py'],
},
}


@contextmanager
def cd(path):
original_dir = os.getcwd()
try:
original_dir = os.getcwd()
os.chdir(path)
yield
finally:
Expand All @@ -43,41 +128,26 @@ def _get_random_package_name():
return 'foobar-%s' % str(uuid.uuid4())[:8]


def _get_package_install_test_cases():
testcases = []
if PY_VERSION <= VERSION_CUTOFF:
version_key = 'legacy_version'
else:
version_key = 'version'
for package, config in PACKAGES_TO_TEST.items():
package_version = f'{package}=={config[version_key]}'
testcases.append(
(package_version, config['contents'])
)
return testcases


# This test can take a while, but you can set this env var to make sure that
# the commonly used python packages can be packaged successfully.
@pytest.mark.skipif(not os.environ.get('CHALICE_TEST_EXTENDED_PACKAGING'),
reason='Set CHALICE_TEST_EXTENDED_PACKAGING for extended '
'packaging tests.')
@pytest.mark.skipif(sys.version_info[0] == 2,
reason='Extended packaging tests only run on py3.')
@pytest.mark.parametrize(
'package,contents', [
('pandas==1.1.5', [
'pandas/_libs/__init__.py',
'pandas/io/sas/_sas.cpython-*-x86_64-linux-gnu.so']),
('SQLAlchemy==1.3.20', [
'sqlalchemy/__init__.py',
'sqlalchemy/cresultproxy.cpython-*-x86_64-linux-gnu.so']),
('numpy==1.19.4', [
'numpy/__init__.py',
'numpy/core/_struct_ufunc_tests.cpython-*-x86_64-linux-gnu.so']),
('cryptography==3.3.1', [
'cryptography/__init__.py',
'cryptography/hazmat/bindings/_openssl.abi3.so']),
('Jinja2==2.11.2', ['jinja2/__init__.py']),
('Mako==1.1.3', ['mako/__init__.py']),
('MarkupSafe==1.1.1', ['markupsafe/__init__.py']),
('scipy==1.5.4', [
'scipy/__init__.py',
'scipy/cluster/_hierarchy.cpython-*-x86_64-linux-gnu.so']),
('cffi==1.14.5', [
'_cffi_backend.cpython-*-x86_64-linux-gnu.so']),
('pygit2==1.5.0', [
'pygit2/_pygit2.cpython-*-x86_64-linux-gnu.so']),
('pyrsistent==0.17.3', [
'pyrsistent/__init__.py']),
]
)
@pytest.mark.parametrize('package,contents', _get_package_install_test_cases())
def test_package_install_smoke_tests(package, contents, runner, app_skeleton):
assert_can_package_dependency(runner, app_skeleton, package, contents)

Expand Down Expand Up @@ -144,10 +214,11 @@ def test_can_package_sqlalchemy(self, runner, app_skeleton,
@pytest.mark.skipif(sys.version_info[0] == 2,
reason='pandas==1.1.5 is only suported on py3.')
def test_can_package_pandas(self, runner, app_skeleton, no_local_config):
version = '1.5.3' if sys.version_info[1] >= 10 else '1.1.5'
assert_can_package_dependency(
runner,
app_skeleton,
'pandas==1.1.5',
'pandas==' + version,
contents=[
'pandas/_libs/__init__.py',
],
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,10 @@ def test_can_load_python_version():
expected_runtime = 'python3.7'
elif minor <= 8:
expected_runtime = 'python3.8'
else:
elif minor <= 9:
expected_runtime = 'python3.9'
else:
expected_runtime = 'python3.10'
assert c.lambda_python_version == expected_runtime


Expand Down