Skip to content

Commit e1c4fc7

Browse files
google-genai-botcopybara-github
authored andcommitted
feat: Add support for Python 3.15.
PiperOrigin-RevId: 1003758162
1 parent 1a64450 commit e1c4fc7

5 files changed

Lines changed: 12 additions & 17 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', '3.15']
16+
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
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', '3.15']
20+
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
2121

2222
steps:
2323
- name: Checkout code

‎google/genai/types.py‎

Lines changed: 7 additions & 8 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
28+
from typing import Annotated, Any, Callable, Dict, List, Literal, Optional, Sequence, Union, _UnionGenericAlias # type: ignore
2929
import pydantic
3030
from pydantic import ConfigDict, Field, PrivateAttr, WrapValidator, model_validator
3131
from typing_extensions import Self, TypedDict
@@ -37,15 +37,14 @@
3737
_UploadToFileSearchStoreOperation_from_mldev,
3838
)
3939

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
44-
_UNION_TYPES = (typing.Union, builtin_types.UnionType)
45-
else:
40+
if sys.version_info >= (3, 10):
4641
# Supports both Union[t1, t2] and t1 | t2
47-
VersionedUnionType = Union[builtin_types.UnionType, typing._UnionGenericAlias] # type: ignore
42+
VersionedUnionType = Union[builtin_types.UnionType, _UnionGenericAlias]
4843
_UNION_TYPES = (typing.Union, builtin_types.UnionType)
44+
else:
45+
# Supports only Union[t1, t2]
46+
VersionedUnionType = _UnionGenericAlias
47+
_UNION_TYPES = (typing.Union,)
4948

5049
_is_pillow_image_imported = False
5150
if typing.TYPE_CHECKING:

‎pyproject.toml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ 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",
2524
"Topic :: Internet",
2625
"Topic :: Software Development :: Libraries :: Python Modules",
2726
]

‎requirements.txt‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,13 @@ google-auth==2.56.0
1212
idna==3.18
1313
iniconfig==2.0.0
1414
packaging==24.2
15-
pillow==11.0.0; python_version < '3.15'
16-
pillow==12.3.0; python_version >= '3.15'
15+
pillow==11.0.0
1716
pluggy==1.5.0
1817
py==1.11.0
1918
pyasn1==0.6.1
2019
pyasn1_modules==0.4.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'
20+
pydantic==2.12.0
21+
pydantic_core==2.41.1
2522
pyopenssl==24.2.1
2623
pytest==8.3.4
2724
pytest-asyncio==0.25.0

0 commit comments

Comments
 (0)