Skip to content

Commit 95b7846

Browse files
committed
resolve comments
1 parent 10bd8d0 commit 95b7846

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

bigframes/functions/_function_client.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
from bigframes_vendored import constants
3030
import requests
3131

32-
from bigframes.functions._utils import get_python_version
3332
import bigframes.functions.function_template as bff_template
3433

3534
if TYPE_CHECKING:
@@ -209,7 +208,7 @@ def provision_bq_managed_function(
209208
bq_function_args.append(f"{name_} {type_}")
210209

211210
managed_function_options = {
212-
"runtime_version": get_python_version(),
211+
"runtime_version": _utils.get_python_version(),
213212
"entry_point": "bigframes_handler",
214213
}
215214

@@ -347,7 +346,7 @@ def create_cloud_function(
347346
# TODO(shobs): Figure out how to achieve version compatibility, specially
348347
# when pickle (internally used by cloudpickle) guarantees that:
349348
# https://docs.python.org/3/library/pickle.html#:~:text=The%20pickle%20serialization%20format%20is,unique%20breaking%20change%20language%20boundary.
350-
python_version = get_python_version(is_compat=True)
349+
python_version = _utils.get_python_version(is_compat=True)
351350

352351
# Determine an upload URL for user code
353352
upload_url_request = functions_v2.GenerateUploadUrlRequest(

bigframes/functions/_function_session.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
from bigframes import clients
5050
import bigframes.core.compile.ibis_types
5151
import bigframes.exceptions as bfe
52-
from bigframes.functions._utils import get_python_version
5352
import bigframes.series as bf_series
5453

5554
if TYPE_CHECKING:
@@ -257,9 +256,9 @@ def remote_function(
257256
cloud_function_max_instances: Optional[int] = None,
258257
cloud_function_vpc_connector: Optional[str] = None,
259258
cloud_function_memory_mib: Optional[int] = 1024,
260-
cloud_function_ingress_settings: Literal[
261-
"all", "internal-only", "internal-and-gclb"
262-
] = "all",
259+
cloud_function_ingress_settings: Optional[
260+
Literal["all", "internal-only", "internal-and-gclb"]
261+
] = None,
263262
):
264263
"""Decorator to turn a user defined function into a BigQuery remote function.
265264
@@ -769,7 +768,7 @@ def udf(
769768
raise NotImplementedError()
770769

771770
# Check the Python version.
772-
python_version = get_python_version()
771+
python_version = _utils.get_python_version()
773772
if python_version not in _MANAGED_FUNC_PYTHON_VERSIONS:
774773
raise RuntimeError(
775774
f"Python version {python_version} is not supported yet for "

bigframes/functions/_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,9 @@ def get_bigframes_metadata(*, python_output_type: Optional[type] = None) -> str:
284284

285285

286286
def get_python_version(is_compat: bool = False) -> str:
287-
# Cloud Run functions use the 'compat' format (e.g., python311), while
288-
# managed functions use the standard format (e.g., python-3.11).
287+
# Cloud Run functions use the 'compat' format (e.g., python311, see more
288+
# from https://cloud.google.com/functions/docs/runtime-support#python),
289+
# while managed functions use the standard format (e.g., python-3.11).
289290
major = sys.version_info.major
290291
minor = sys.version_info.minor
291292
return f"python{major}{minor}" if is_compat else f"python-{major}.{minor}"

bigframes/session/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1404,7 +1404,7 @@ def remote_function(
14041404
cloud_function_max_instances=cloud_function_max_instances,
14051405
cloud_function_vpc_connector=cloud_function_vpc_connector,
14061406
cloud_function_memory_mib=cloud_function_memory_mib,
1407-
cloud_function_ingress_settings=cloud_function_ingress_settings, # type: ignore
1407+
cloud_function_ingress_settings=cloud_function_ingress_settings,
14081408
)
14091409

14101410
def udf(

0 commit comments

Comments
 (0)