Skip to content

Commit 1a64450

Browse files
speedstorm1copybara-github
authored andcommitted
feat: Add support for Python 3.15.
PiperOrigin-RevId: 1003696998
1 parent a570399 commit 1a64450

5 files changed

Lines changed: 17 additions & 12 deletions

File tree

‎.github/workflows/import.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313

1414
strategy:
1515
matrix:
16-
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
16+
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14', '3.15']
1717

1818
steps:
1919
- name: Checkout repository

‎.github/workflows/mypy.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818
strategy:
1919
matrix:
20-
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
20+
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14', '3.15']
2121

2222
steps:
2323
- name: Checkout code

‎google/genai/types.py‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import sys
2626
import types as builtin_types
2727
import typing
28-
from typing import Annotated, Any, Callable, Dict, List, Literal, Optional, Sequence, Union, _UnionGenericAlias # type: ignore
28+
from typing import Annotated, Any, Callable, Dict, List, Literal, Optional, Sequence, Union
2929
import pydantic
3030
from pydantic import ConfigDict, Field, PrivateAttr, WrapValidator, model_validator
3131
from typing_extensions import Self, TypedDict
@@ -37,14 +37,15 @@
3737
_UploadToFileSearchStoreOperation_from_mldev,
3838
)
3939

40-
if sys.version_info >= (3, 10):
41-
# Supports both Union[t1, t2] and t1 | t2
42-
VersionedUnionType = Union[builtin_types.UnionType, _UnionGenericAlias]
40+
if sys.version_info >= (3, 14):
41+
# Union[t1, t2] and t1 | t2 both create builtin_types.UnionType, and
42+
# typing._UnionGenericAlias is deprecated.
43+
VersionedUnionType = builtin_types.UnionType
4344
_UNION_TYPES = (typing.Union, builtin_types.UnionType)
4445
else:
45-
# Supports only Union[t1, t2]
46-
VersionedUnionType = _UnionGenericAlias
47-
_UNION_TYPES = (typing.Union,)
46+
# Supports both Union[t1, t2] and t1 | t2
47+
VersionedUnionType = Union[builtin_types.UnionType, typing._UnionGenericAlias] # type: ignore
48+
_UNION_TYPES = (typing.Union, builtin_types.UnionType)
4849

4950
_is_pillow_image_imported = False
5051
if typing.TYPE_CHECKING:

‎pyproject.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ classifiers = [
2121
"Programming Language :: Python :: 3.12",
2222
"Programming Language :: Python :: 3.13",
2323
"Programming Language :: Python :: 3.14",
24+
"Programming Language :: Python :: 3.15",
2425
"Topic :: Internet",
2526
"Topic :: Software Development :: Libraries :: Python Modules",
2627
]

‎requirements.txt‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@ google-auth==2.56.0
1212
idna==3.18
1313
iniconfig==2.0.0
1414
packaging==24.2
15-
pillow==11.0.0
15+
pillow==11.0.0; python_version < '3.15'
16+
pillow==12.3.0; python_version >= '3.15'
1617
pluggy==1.5.0
1718
py==1.11.0
1819
pyasn1==0.6.1
1920
pyasn1_modules==0.4.1
20-
pydantic==2.12.0
21-
pydantic_core==2.41.1
21+
pydantic==2.12.0; python_version < '3.15'
22+
pydantic==2.14.1; python_version >= '3.15'
23+
pydantic_core==2.41.1; python_version < '3.15'
24+
pydantic_core==2.50.1; python_version >= '3.15'
2225
pyopenssl==24.2.1
2326
pytest==8.3.4
2427
pytest-asyncio==0.25.0

0 commit comments

Comments
 (0)