-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Python 3.12 #2087
Conversation
6bf3e72
to
f37256d
Compare
Looks like there's some issues with the pylint specific to python3.12 that I'll need to track down. Otherwise the feature itself seems to be working (I can deploy python3.12 apps to Lambda). |
.github/workflows/run-tests.yml
Outdated
@@ -53,8 +53,7 @@ jobs: | |||
runs-on: ubuntu-latest | |||
strategy: | |||
matrix: | |||
python-version: [3.7, 3.8, 3.9, '3.10', 3.11] | |||
cdk-version: [cdk, cdkv2] | |||
python-version: [3.7, 3.8, 3.9, '3.10', 3.11, 3.12] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, any reason to still support Python 3.7 since it's EOL?
https://devguide.python.org/versions/
https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a branch that removes 3.7 support, but we're following the python support policy for AWS SDKs and Tools (https://aws.amazon.com/blogs/developer/python-support-policy-updates-for-aws-sdks-and-tools/), which would drop 3.7 support at the end of this month.
I was hoping to get 3.12 support released quickly and then drop support for 3.7 next month, but depending on how long it takes to work out the remaining 3.12 issues, we might end having 3.12 support + dropping 3.7 in the same release if it ends up getting pushed to next month.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jamesls It's the new year, any chance you could take a look at this again?
@jamesls @devinmatte is there any update on getting this out? |
@jamesls @devinmatte seems like 3.7 support was dropped. So you are planning to remove 3.7 support and add 3.12 with this same PR? |
@@ -379,8 +379,10 @@ def test_can_load_python_version(): | |||
expected_runtime = 'python3.9' | |||
elif minor <= 10: | |||
expected_runtime = 'python3.10' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also here, we are Py 3.7+ if not 3.8+, a lot can disappear
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, there's a number of places in the tests that still reference older versions of python that can be removed. I'll send a follow up pull request to clean these up.
Quick update, python 3.7 has been deprecated for a few months now and haven't seen any issues in the SDK/other projects so I think we should be good to move ahead with also dropping 3.7 support. I think the simplest path here is to send a pr to drop 3.7 support, the rebase this PR on top. Working on this now, should have an update shortly. |
Py37 dropped in #2095, going to rebase now and should be able to get a clean run through CI. |
In addition to the mechanical changes needed to support a new Python version, I also made a few additional changes to get everything passing: * Removed testing cdkv1. CDK v1 is deprecated now, and while we still have code that will try and import cdkv1, we're no longer testing support for CDK v1. * Refresh the test/dev dependencies via `pip-compile`. New package versions were needed for Python 3.12 support. * Update the pylintrc config to match the previous behavior of earlier versions * Only use `typing_extensions` on Python 3.7, which is the only version that needs this. `TypedDict` was added in 3.8, and it's the only thing from that package that we use.
f37256d
to
1c376e3
Compare
* Had to mess with Pylint because we needed to upgrade to a new major version to get python3.12 support. * Breaking changes in the API required the custom pylint checkers to be updated. * Also needed to update how we load custom plugins because the python path is changed in the new version of pylint. * Needed to update the code for the linters because they were checking for the third party mock library which we haven't used in a long time. * Had to update a few test case classes to not use the nose style tests which have been deprecated and now generate pytest errors. * Test installation of pandas 2.x on 3.10 and higher. The older versions don't have prebuilt binaries and will result in trying to compile the package, which we do not want. * Update several tests to use the updated pytest APIs for testing for emitted warnings.
1c376e3
to
5c0652a
Compare
In addition to the mechanical changes needed to support a new Python version, I also made a few additional changes to get everything passing:
pip-compile
. New package versions were needed for Python 3.12 support.typing_extensions
on Python 3.7, which is the only version that needs this.TypedDict
was added in 3.8, and it's the only thing from that package that we use.Closes #2086