Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/import.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
python-version: ['3.11', '3.12', '3.13', '3.14', '3.15']

steps:
- name: Checkout repository
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
python-version: ['3.11', '3.12', '3.13', '3.14', '3.15']

steps:
- name: Checkout code
Expand Down
20 changes: 13 additions & 7 deletions google/genai/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import sys
import types as builtin_types
import typing
from typing import Annotated, Any, Callable, Dict, List, Literal, Optional, Sequence, Union, _UnionGenericAlias # type: ignore
from typing import Annotated, Any, Callable, Dict, List, Literal, Optional, Sequence, Union
import pydantic
from pydantic import ConfigDict, Field, PrivateAttr, WrapValidator, model_validator
from typing_extensions import Self, TypedDict
Expand All @@ -37,14 +37,20 @@
_UploadToFileSearchStoreOperation_from_mldev,
)

if sys.version_info >= (3, 10):
# Supports both Union[t1, t2] and t1 | t2
VersionedUnionType = Union[builtin_types.UnionType, _UnionGenericAlias]
if typing.TYPE_CHECKING:
# Type checkers have always seen this as Any, which lets SchemaUnion accept
# any schema (e.g. Optional[X]). Keep it that way.
VersionedUnionType = Any
_UNION_TYPES = (typing.Union, builtin_types.UnionType)
elif sys.version_info >= (3, 14):
# Union[t1, t2] and t1 | t2 both create builtin_types.UnionType, and
# typing._UnionGenericAlias is deprecated.
VersionedUnionType = builtin_types.UnionType
_UNION_TYPES = (typing.Union, builtin_types.UnionType)
else:
# Supports only Union[t1, t2]
VersionedUnionType = _UnionGenericAlias
_UNION_TYPES = (typing.Union,)
# Supports both Union[t1, t2] and t1 | t2
VersionedUnionType = Union[builtin_types.UnionType, typing._UnionGenericAlias] # type: ignore
_UNION_TYPES = (typing.Union, builtin_types.UnionType)

_is_pillow_image_imported = False
if typing.TYPE_CHECKING:
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ version = "2.33.0"
description = "GenAI Python SDK"
readme = "README.md"
license = "Apache-2.0"
requires-python = ">=3.10"
requires-python = ">=3.11"
authors = [
{ name = "Google LLC", email = "googleapis-packages@google.com" },
]
Expand All @@ -16,11 +16,11 @@ classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3.15",
"Topic :: Internet",
"Topic :: Software Development :: Libraries :: Python Modules",
]
Expand Down
9 changes: 6 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ google-auth==2.56.0
idna==3.18
iniconfig==2.0.0
packaging==24.2
pillow==11.0.0
pillow==11.0.0; python_version < '3.15'
pillow==12.3.0; python_version >= '3.15'
pluggy==1.5.0
py==1.11.0
pyasn1==0.6.1
pyasn1_modules==0.4.1
pydantic==2.12.0
pydantic_core==2.41.1
pydantic==2.12.0; python_version < '3.15'
pydantic==2.14.1; python_version >= '3.15'
pydantic_core==2.41.1; python_version < '3.15'
pydantic_core==2.50.1; python_version >= '3.15'
pyopenssl==24.2.1
pytest==8.3.4
pytest-asyncio==0.25.0
Expand Down
Loading