-
Notifications
You must be signed in to change notification settings - Fork 2.5k
fix: partially support Python3.14 #3859
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
base: develop
Are you sure you want to change the base?
Conversation
Allow the transform to be used in Python3.14, except GraphQLApi and Capacity Providers functionalities. `make pr` still doesn't work, but the transform can be used successfully in Python 3.14 (if not using the above features) ``` bin/sam-translate.py --template ./template.yaml ```
roger-zhangg
left a comment
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.
LGTM
samtranslator/model/sam_resources.py
Outdated
| aws_serverless_function, | ||
| aws_serverless_graphqlapi, | ||
| ) | ||
| except Exception: |
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.
small thing
| except Exception: | |
| except ImportError: |
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.
Actually I tried this initially, but the exception here is not an ImportError. It's not that the library doesn't exist.. This actually just sends a RuntimeException coming from somewhere in pydantic code. And at that point I imagined that it's not really relevant where the exception came from.
Allow the transform to be used in Python3.14, except GraphQLApi and Capacity Providers functionalities.
make prstill doesn't work, but the transform can be used successfully in Python 3.14 (if not using the above features)Issue #, if available
#3831
Description of changes
Add a try/except when importing the model classes. These classes are only used for Capacity Provider and GraphQLApi, so those items are still not supported when using Python3.14. But at least for now the rest of the transform works correctly.
I also removed a variable
resource_property_schemathat was being initialized for the Lambda Capacity Provider class definition, but it never changed value and it was used only once. So I replaced it with the value imported directly instead of saving it in an intermediate variable.I also updated
jsonschemaversion because the previous version wasn't supported in python3.14. I also removedcloudformation-clifrom dev dependencies, because it doesn't support latest versions of Python (and it's not actually used for anything)Description of how you validated changes
Manual tests
make pris still failing, because of course all the Capacity Provider and GraphQLApi tests that now are not working. And also a couple of other tests that import the model too, that are failing with pydantic v1. That's one of the reasons why we can't count python3.14 as really "supported" yet.Checklist
Examples?
Please reach out in the comments if you want to add an example. Examples will be
added to
sam initthrough aws/aws-sam-cli-app-templates.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.