Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
- "3.11"
- "3.12"
- "3.13"
- "3.14"
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
Expand Down
2 changes: 1 addition & 1 deletion DEVELOPMENT_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Environment setup
-----------------
### 1. Install Python versions

Our officially supported Python versions are 3.10, 3.11, 3.12, 3.13
Our officially supported Python versions are 3.10, 3.11, 3.12, 3.13, 3.14
Our CI/CD pipeline is setup to run unit tests against Python 3 versions. Make sure you test it before sending a Pull Request.
See [Unit testing with multiple Python versions](#unit-testing-with-multiple-python-versions).

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.black]
line-length = 120
target_version = ['py310', 'py311', 'py312', 'py313']
target_version = ['py310', 'py311', 'py312', 'py313', 'py314']
exclude = '''

(
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ jsonschema<5,>=4.23
typing_extensions>=4.4

# resource validation & schema generation
pydantic~=2.12.5
pydantic~=2.13.3
31 changes: 5 additions & 26 deletions samtranslator/model/sam_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

import copy
import re
import sys
from collections.abc import Callable
from contextlib import suppress
from types import ModuleType
from typing import Any, Literal, Union, cast

import samtranslator.model.eventsources
Expand Down Expand Up @@ -37,19 +35,11 @@
SyncConfigType,
UserPoolConfigType,
)

# Pydantic 1 doesn't support Python 3.14 so these imports will fail until we migrate to v2
try:
from samtranslator.internal.schema_source import (
aws_serverless_capacity_provider,
aws_serverless_function,
aws_serverless_graphqlapi,
)
except RuntimeError: # Pydantic fails when initializing the model classes with a RuntimeError in 3.14
aws_serverless_capacity_provider = cast(ModuleType, None)
aws_serverless_function = cast(ModuleType, None)
aws_serverless_graphqlapi = cast(ModuleType, None)

from samtranslator.internal.schema_source import (
aws_serverless_capacity_provider,
aws_serverless_function,
aws_serverless_graphqlapi,
)
from samtranslator.internal.schema_source.common import PermissionsType, SamIntrinsicable
from samtranslator.internal.types import GetManagedPolicyMap
from samtranslator.internal.utils.utils import passthrough_value, remove_none_values
Expand Down Expand Up @@ -158,14 +148,6 @@
_CONDITION_CHAR_LIMIT = 255


# Utility function to throw an error when using functionality that doesn't work in Python 3.14 (need migration to Pydantic v2)
def check_python_314_compatibility(module: ModuleType | None, functionality: str) -> None:
if sys.version_info >= (3, 14) and module is None:
raise RuntimeError(
f"{functionality} functionalities are temporarily not supported when running SAM in Python 3.14"
)


class SamFunction(SamResourceMacro):
"""SAM function macro."""

Expand Down Expand Up @@ -811,7 +793,6 @@ def _transform_capacity_provider_config(self) -> dict[str, Any]:

# Validate CapacityProviderConfig using Pydantic model directly for comprehensive error collection
try:
check_python_314_compatibility(aws_serverless_function, "Capacity Provider")
validated_model = aws_serverless_function.CapacityProviderConfig.parse_obj(self.CapacityProviderConfig)
except Exception as e:
raise InvalidResourceException(self.logical_id, f"Invalid CapacityProviderConfig: {e!s}") from e
Expand Down Expand Up @@ -1574,7 +1555,6 @@ def to_cloudformation(self, **kwargs: Any) -> list[Resource]:
"""
Transform the SAM CapacityProvider resource to CloudFormation
"""
check_python_314_compatibility(aws_serverless_capacity_provider, "Capacity Provider")
self.validate_before_transform(
schema_class=aws_serverless_capacity_provider.Properties,
collect_all_errors=True,
Expand Down Expand Up @@ -2792,7 +2772,6 @@ def __init__(

@cw_timer
def to_cloudformation(self, **kwargs: Any) -> list[Resource]:
check_python_314_compatibility(aws_serverless_graphqlapi, "GraphQLApi")
model = self.validate_properties_and_return_model(aws_serverless_graphqlapi.Properties)

appsync_api, cloudwatch_role, auth_connectors = self._construct_appsync_api_resources(model)
Expand Down
Loading