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
13 changes: 11 additions & 2 deletions sdks/python/apache_beam/typehints/typehints.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@
import typing
from collections import abc

from beartype.door import is_subhint
from beartype.roar import BeartypeDoorException

__all__ = [
'Any',
'Union',
Expand Down Expand Up @@ -1483,7 +1486,7 @@ def normalize(x, none_as_type=False):
})


def is_consistent_with(sub, base):
def is_consistent_with(sub, base, use_beartype: bool = False) -> bool:
"""Checks whether sub a is consistent with base.

This is according to the terminology of PEP 483/484. This relationship is
Expand Down Expand Up @@ -1522,7 +1525,13 @@ def is_consistent_with(sub, base):
# Cannot check unsupported parameterized generic which will cause issubclass
# to fail with an exception.
return False
return issubclass(sub, base)
if use_beartype:
try:
return is_subhint(sub, base)
except (BeartypeDoorException):
return False
else:
return issubclass(sub, base)


def regex_consistency(sub, base) -> bool:
Expand Down
5 changes: 3 additions & 2 deletions sdks/python/container/ml/py310/base_image_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ astunparse==1.6.3
async-timeout==5.0.1
attrs==25.3.0
backports.tarfile==1.2.0
beartype==0.21.0
beautifulsoup4==4.13.4
bs4==0.0.2
build==1.3.0
Expand Down Expand Up @@ -191,7 +192,7 @@ pytest-timeout==2.4.0
pytest-xdist==3.8.0
python-dateutil==2.9.0.post0
python-dotenv==1.1.1
python-tds==1.16.1
python-tds==1.17.0
pytz==2025.2
PyYAML==6.0.2
redis==5.3.1
Expand Down Expand Up @@ -244,4 +245,4 @@ wheel==0.45.1
wrapt==1.17.3
yarl==1.20.1
zipp==3.23.0
zstandard==0.23.0
zstandard==0.24.0
5 changes: 3 additions & 2 deletions sdks/python/container/ml/py311/base_image_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ asn1crypto==1.5.1
astunparse==1.6.3
attrs==25.3.0
backports.tarfile==1.2.0
beartype==0.21.0
beautifulsoup4==4.13.4
bs4==0.0.2
build==1.3.0
Expand Down Expand Up @@ -189,7 +190,7 @@ pytest-timeout==2.4.0
pytest-xdist==3.8.0
python-dateutil==2.9.0.post0
python-dotenv==1.1.1
python-tds==1.16.1
python-tds==1.17.0
pytz==2025.2
PyYAML==6.0.2
redis==5.3.1
Expand Down Expand Up @@ -241,4 +242,4 @@ wheel==0.45.1
wrapt==1.17.3
yarl==1.20.1
zipp==3.23.0
zstandard==0.23.0
zstandard==0.24.0
5 changes: 3 additions & 2 deletions sdks/python/container/ml/py312/base_image_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ anyio==4.10.0
asn1crypto==1.5.1
astunparse==1.6.3
attrs==25.3.0
beartype==0.21.0
beautifulsoup4==4.13.4
bs4==0.0.2
build==1.3.0
Expand Down Expand Up @@ -188,7 +189,7 @@ pytest-timeout==2.4.0
pytest-xdist==3.8.0
python-dateutil==2.9.0.post0
python-dotenv==1.1.1
python-tds==1.16.1
python-tds==1.17.0
pytz==2025.2
PyYAML==6.0.2
redis==5.3.1
Expand Down Expand Up @@ -239,4 +240,4 @@ wheel==0.45.1
wrapt==1.17.3
yarl==1.20.1
zipp==3.23.0
zstandard==0.23.0
zstandard==0.24.0
5 changes: 3 additions & 2 deletions sdks/python/container/ml/py39/base_image_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ astunparse==1.6.3
async-timeout==5.0.1
attrs==25.3.0
backports.tarfile==1.2.0
beartype==0.21.0
beautifulsoup4==4.13.4
bs4==0.0.2
build==1.3.0
Expand Down Expand Up @@ -191,7 +192,7 @@ pytest-timeout==2.4.0
pytest-xdist==3.8.0
python-dateutil==2.9.0.post0
python-dotenv==1.1.1
python-tds==1.16.1
python-tds==1.17.0
pytz==2025.2
PyYAML==6.0.2
redis==5.3.1
Expand Down Expand Up @@ -244,4 +245,4 @@ wheel==0.45.1
wrapt==1.17.3
yarl==1.20.1
zipp==3.23.0
zstandard==0.23.0
zstandard==0.24.0
5 changes: 3 additions & 2 deletions sdks/python/container/py310/base_image_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ asn1crypto==1.5.1
async-timeout==5.0.1
attrs==25.3.0
backports.tarfile==1.2.0
beartype==0.21.0
beautifulsoup4==4.13.4
bs4==0.0.2
build==1.3.0
Expand Down Expand Up @@ -155,7 +156,7 @@ pytest-timeout==2.4.0
pytest-xdist==3.8.0
python-dateutil==2.9.0.post0
python-dotenv==1.1.1
python-tds==1.16.1
python-tds==1.17.0
pytz==2025.2
PyYAML==6.0.2
redis==5.3.1
Expand Down Expand Up @@ -194,4 +195,4 @@ wheel==0.45.1
wrapt==1.17.3
yarl==1.20.1
zipp==3.23.0
zstandard==0.23.0
zstandard==0.24.0
5 changes: 3 additions & 2 deletions sdks/python/container/py311/base_image_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ anyio==4.10.0
asn1crypto==1.5.1
attrs==25.3.0
backports.tarfile==1.2.0
beartype==0.21.0
beautifulsoup4==4.13.4
bs4==0.0.2
build==1.3.0
Expand Down Expand Up @@ -153,7 +154,7 @@ pytest-timeout==2.4.0
pytest-xdist==3.8.0
python-dateutil==2.9.0.post0
python-dotenv==1.1.1
python-tds==1.16.1
python-tds==1.17.0
pytz==2025.2
PyYAML==6.0.2
redis==5.3.1
Expand Down Expand Up @@ -191,4 +192,4 @@ wheel==0.45.1
wrapt==1.17.3
yarl==1.20.1
zipp==3.23.0
zstandard==0.23.0
zstandard==0.24.0
5 changes: 3 additions & 2 deletions sdks/python/container/py312/base_image_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ annotated-types==0.7.0
anyio==4.10.0
asn1crypto==1.5.1
attrs==25.3.0
beartype==0.21.0
beautifulsoup4==4.13.4
bs4==0.0.2
build==1.3.0
Expand Down Expand Up @@ -152,7 +153,7 @@ pytest-timeout==2.4.0
pytest-xdist==3.8.0
python-dateutil==2.9.0.post0
python-dotenv==1.1.1
python-tds==1.16.1
python-tds==1.17.0
pytz==2025.2
PyYAML==6.0.2
redis==5.3.1
Expand Down Expand Up @@ -190,4 +191,4 @@ wheel==0.45.1
wrapt==1.17.3
yarl==1.20.1
zipp==3.23.0
zstandard==0.23.0
zstandard==0.24.0
7 changes: 4 additions & 3 deletions sdks/python/container/py313/base_image_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ annotated-types==0.7.0
anyio==4.10.0
asn1crypto==1.5.1
attrs==25.3.0
beartype==0.21.0
beautifulsoup4==4.13.4
bs4==0.0.2
build==1.3.0
Expand Down Expand Up @@ -98,7 +99,7 @@ jeepney==0.9.0
Jinja2==3.1.6
joblib==1.5.1
jsonpickle==3.4.2
jsonschema==4.25.0
jsonschema==4.25.1
jsonschema-specifications==2025.4.1
keyring==25.6.0
keyrings.google-artifactregistry-auth==1.1.2
Expand Down Expand Up @@ -150,7 +151,7 @@ pytest-timeout==2.4.0
pytest-xdist==3.8.0
python-dateutil==2.9.0.post0
python-dotenv==1.1.1
python-tds==1.16.1
python-tds==1.17.0
pytz==2025.2
PyYAML==6.0.2
redis==5.3.1
Expand Down Expand Up @@ -187,4 +188,4 @@ wheel==0.45.1
wrapt==1.17.3
yarl==1.20.1
zipp==3.23.0
zstandard==0.23.0
zstandard==0.24.0
5 changes: 3 additions & 2 deletions sdks/python/container/py39/base_image_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ asn1crypto==1.5.1
async-timeout==5.0.1
attrs==25.3.0
backports.tarfile==1.2.0
beartype==0.21.0
beautifulsoup4==4.13.4
bs4==0.0.2
build==1.3.0
Expand Down Expand Up @@ -155,7 +156,7 @@ pytest-timeout==2.4.0
pytest-xdist==3.8.0
python-dateutil==2.9.0.post0
python-dotenv==1.1.1
python-tds==1.16.1
python-tds==1.17.0
pytz==2025.2
PyYAML==6.0.2
redis==5.3.1
Expand Down Expand Up @@ -194,4 +195,4 @@ wheel==0.45.1
wrapt==1.17.3
yarl==1.20.1
zipp==3.23.0
zstandard==0.23.0
zstandard==0.24.0
1 change: 1 addition & 0 deletions sdks/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ def get_portability_package_data():
'typing-extensions>=3.7.0',
'zstandard>=0.18.0,<1',
'pyyaml>=3.12,<7.0.0',
'beartype>=0.21.0,<0.22.0',
# Dynamic dependencies must be specified in a separate list, otherwise
# Dependabot won't be able to parse the main list. Any dynamic
# dependencies will not receive updates from Dependabot.
Expand Down
Loading