Skip to content

feat: fully support Python 3.14#3913

Merged
valerena merged 2 commits intoaws:developfrom
valerena:support-py314
Apr 22, 2026
Merged

feat: fully support Python 3.14#3913
valerena merged 2 commits intoaws:developfrom
valerena:support-py314

Conversation

@valerena
Copy link
Copy Markdown
Contributor

  • Update to Pydantic >= 2.13, which added support for Python 3.14 in the legacy v1 version included (that we're using)
    https://pypi.org/project/pydantic/2.13.0/

  • Remove previous checks that make the code fail in Python 3.14 for some functionality.

Issue #, if available

#3831

Description of changes

The new version of Pydantic allows its v1 to support Python 3.14, so we can support it without having to migrate to v2 yet.

Description of how you validated changes

  • make pr

Checklist

Examples?

Please reach out in the comments if you want to add an example. Examples will be
added to sam init through 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.

@valerena valerena requested a review from a team as a code owner April 17, 2026 21:02
@valerena
Copy link
Copy Markdown
Contributor Author

There's a failure because in theory this commit has a "breaking change" because I deleted the function that checked for compatibility with Python 3.14.

https://github.com/aws/serverless-application-model/actions/runs/24586557608/job/71897507275?pr=3913#logs

## Deleted routines
- samtranslator.model.sam_resources.check_python_314_compatibility

I could add it again, but of course this is not something that customers would really call when using SAM, so I think it's okay to just delete it here, and potentially override the failure in the check to be able to merge. (Unless someone has a different opinion)

Comment thread requirements/base.txt Outdated
@roger-zhangg
Copy link
Copy Markdown
Member

humm, seems v2.13.3 is messing things up. And it only works correctly in python3.14. Do we see this as a potential risk?
We can either look deeper or change the version to pydantic==2.13.2 assuming 2.13.2 would work.

@roger-zhangg
Copy link
Copy Markdown
Member

roger-zhangg commented Apr 21, 2026

FYI

    cfn-lint 1.49.1: requires_python=<3.14,>=3.10                                                                                                                                                                                   
    cfn-lint 1.49.0: requires_python=<3.14,>=3.10                                                                                                                                                                                   
    cfn-lint 1.48.1: requires_python=>=3.10                                                                                                                                                                                         
    cfn-lint 1.48.0: requires_python=>=3.10                                                                                                                                                                                         
    cfn-lint 1.47.1: requires_python=>=3.10 

cfn-lint >= 1.49 stopped supporting python3.14.
So in our python3.14 test, we are actually running cfn-lint 1.48.1 where the 3.10-3.13 test are running cfn-lint 1.49.1

@roger-zhangg
Copy link
Copy Markdown
Member

roger-zhangg commented Apr 21, 2026

Confirmed all these error is comming from cfn-lint 1.49.1
See exact same error in other unrelated PR: https://github.com/aws/serverless-application-model/actions/runs/24733986746/job/72395872762?pr=3914

All the error is comming from this cfn-lint update:
aws-cloudformation/cfn-lint#4442

These new rule start linting on our test resource names

@roger-zhangg
Copy link
Copy Markdown
Member

roger-zhangg commented Apr 21, 2026

Seems the most straightforward fix is to add
https://github.com/aws/serverless-application-model/blob/develop/.cfnlintrc.yaml#L122

  - E1041 # Ref/GetAtt format mismatch; test fixtures use refs that resolve correctly at deploy time
  - E1156 # Invalid IAM Role ARN format; test fixtures use placeholder values
  - E1157 # Invalid KMS Key ARN format; test fixtures use placeholder values
  - E1159 # Invalid ACM Certificate ARN format; test fixtures use placeholder values
  - W1031 # Fn::Sub resolved value format mismatch; test fixtures use simplified ARN patterns

Alternative is to make all test resource naming comply. But that's a huge effort

@valerena
Copy link
Copy Markdown
Contributor Author

valerena commented Apr 21, 2026

I think cfn-lint doesn't work correctly in Python 3.14 precisely because it has this package as its dependency
https://github.com/aws-cloudformation/cfn-lint/blob/main/requirements/base.txt#L2

aws-sam-translator>=1.109.0

It's kind of a cycle, where they depend on us, but we depend on them too. Hopefully we can merge this soon so everyone can be happy with Python 3.14.

valerena and others added 2 commits April 21, 2026 23:22
- Update to Pydantic >= 2.13, which added support for Python 3.14
in the legacy v1 version included
https://pypi.org/project/pydantic/2.13.0/

- Remove previous checks that make the code fail in Python 3.14 for
some functionality.
@valerena valerena merged commit 6689aa3 into aws:develop Apr 22, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants