Skip to content

Commit

Permalink
Merge branch 'python_3.11'
Browse files Browse the repository at this point in the history
PR #2063

* python_3.11:
  Add changelog entry for python3.11
  bump versions for 3.11
  update links to powertools
  reduce number of returns
  initial pass at 3.11
  • Loading branch information
jamesls committed Dec 12, 2023
2 parents 79838b0 + babf734 commit 3ec3e22
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "feature",
"category": "Python",
"description": "Add support for Python 3.11 (#2053)"
}
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, '3.10']
python-version: [3.8, 3.9, '3.10', 3.11]
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, '3.10']
python-version: [3.7, 3.8, 3.9, '3.10', 3.11]
cdk-version: [cdk, cdkv2]
steps:
- uses: actions/checkout@v2
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, python3.10.
which includes python3.6, python3.7, python3.8, python3.9, python3.10, python3.11.
You can find the latest versions of python on the
`Python download page <https://www.python.org/downloads/>`_.

Expand Down
13 changes: 5 additions & 8 deletions chalice/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,13 @@ def lambda_python_version(self) -> str:
if major == 2:
return 'python2.7'
# Python 3 for backwards compatibility needs to select python3.6
# for python versions 3.0-3.6. 3.7 and higher will use python3.7.
# for python versions 3.0-3.6. 3.7-3.10 will use their version.
# 3.11 and higher will use 3.11
elif (major, minor) <= (3, 6):
return 'python3.6'
elif (major, minor) <= (3, 7):
return 'python3.7'
elif (major, minor) <= (3, 8):
return 'python3.8'
elif (major, minor) <= (3, 9):
return 'python3.9'
return 'python3.10'
elif (major, minor) <= (3, 10):
return 'python%s.%s' % (major, minor)
return 'python3.11'

@property
def log_retention_in_days(self) -> int:
Expand Down
4 changes: 3 additions & 1 deletion chalice/deploy/packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class BaseLambdaDeploymentPackager(object):
'python3.8': 'cp38',
'python3.9': 'cp39',
'python3.10': 'cp310',
'python3.11': 'cp311',
}

def __init__(
Expand Down Expand Up @@ -498,7 +499,8 @@ class DependencyBuilder(object):
'cp36m': (2, 17),
'cp37m': (2, 17),
'cp38': (2, 26),
'cp310': (2, 26)
'cp310': (2, 26),
'cp311': (2, 26),
}
# Fallback version if we're on an unknown python version
# not in _RUNTIME_GLIBC.
Expand Down
6 changes: 3 additions & 3 deletions docs/source/topics/middleware.rst
Original file line number Diff line number Diff line change
Expand Up @@ -271,15 +271,15 @@ Integrating with AWS Lambda Powertools
--------------------------------------

`AWS Lambda Powertools
<https://awslabs.github.io/aws-lambda-powertools-python/latest/>`__ is a suite of
<https://docs.powertools.aws.dev/lambda/python/latest/>`__ is a suite of
utilities for AWS Lambda functions that makes tracing with AWS X-Ray,
structured logging and creating custom metrics asynchronously easier.

You can use Chalice middleware to easily integrate Lambda Powertools with
your Chalice apps. In this example, we'll use the
`Logger
<https://awslabs.github.io/aws-lambda-powertools-python/latest/core/logger/>`__
and `Tracer <https://awslabs.github.io/aws-lambda-powertools-python/latest/core/tracer/>`__
<https://docs.powertools.aws.dev/lambda/python/latest/core/logger/>`__
and `Tracer <https://docs.powertools.aws.dev/lambda/python/latest/core/tracer/>`__
and convert them to Chalice middleware so they will be automatically applied
to all Lambda functions in our application.

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,6 @@ def recursive_include(relative_dir):
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
],
)
2 changes: 2 additions & 0 deletions tests/functional/cli/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,8 @@ def test_error_when_no_deployed_record(runner, mock_cli_factory):
reason="Cannot generate pipeline for python3.9.")
@pytest.mark.skipif(sys.version_info[:2] == (3, 10),
reason="Cannot generate pipeline for python3.10.")
@pytest.mark.skipif(sys.version_info[:2] == (3, 11),
reason="Cannot generate pipeline for python3.11.")
def test_can_generate_pipeline_for_all(runner):
with runner.isolated_filesystem():
newproj.create_new_project_skeleton('testproject')
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
],
},
'numpy': {
'version': '1.21.6',
'version': '1.23.3',
'legacy_version': '1.19.4',
'contents': [
'numpy/__init__.py',
Expand Down Expand Up @@ -76,7 +76,7 @@
'contents': ['markupsafe/__init__.py'],
},
'scipy': {
'version': '1.7.3',
'version': '1.10.1',
'legacy_version': '1.5.4',
'contents': [
'scipy/__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 @@ -377,8 +377,10 @@ def test_can_load_python_version():
expected_runtime = 'python3.8'
elif minor <= 9:
expected_runtime = 'python3.9'
else:
elif minor <= 10:
expected_runtime = 'python3.10'
else:
expected_runtime = 'python3.11'
assert c.lambda_python_version == expected_runtime


Expand Down

0 comments on commit 3ec3e22

Please sign in to comment.