diff --git a/docs/user-guide/expressions/plugins.md b/docs/user-guide/expressions/plugins.md index 22842e3e72a9..1f075650e975 100644 --- a/docs/user-guide/expressions/plugins.md +++ b/docs/user-guide/expressions/plugins.md @@ -94,7 +94,7 @@ expression in batches. Whereas for other operations this would not be allowed, t # expression_lib/__init__.py import polars as pl from polars.type_aliases import IntoExpr -from polars._utils.udfs import _get_shared_lib_location +from polars.utils.udfs import _get_shared_lib_location from expression_lib.utils import parse_into_expr diff --git a/py-polars/polars/_utils/udfs.py b/py-polars/polars/_utils/udfs.py index 3cf27d1a7e07..e0450b3b4d89 100644 --- a/py-polars/polars/_utils/udfs.py +++ b/py-polars/polars/_utils/udfs.py @@ -977,17 +977,4 @@ def warn_on_inefficient_map( ) -def is_shared_lib(file: str) -> bool: - return file.endswith((".so", ".dll", ".pyd")) - - -def _get_shared_lib_location(main_file: Any) -> str: - import os - - directory = os.path.dirname(main_file) # noqa: PTH120 - return os.path.join( # noqa: PTH118 - directory, next(filter(is_shared_lib, os.listdir(directory))) - ) - - -__all__ = ["BytecodeParser", "warn_on_inefficient_map", "_get_shared_lib_location"] +__all__ = ["BytecodeParser", "warn_on_inefficient_map"] diff --git a/py-polars/polars/utils/__init__.py b/py-polars/polars/utils/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/py-polars/polars/utils/udfs.py b/py-polars/polars/utils/udfs.py new file mode 100644 index 000000000000..d712db047b03 --- /dev/null +++ b/py-polars/polars/utils/udfs.py @@ -0,0 +1,15 @@ +import os +from typing import Any + +__all__ = ["_get_shared_lib_location"] + + +def _get_shared_lib_location(main_file: Any) -> str: + directory = os.path.dirname(main_file) # noqa: PTH120 + return os.path.join( # noqa: PTH118 + directory, next(filter(_is_shared_lib, os.listdir(directory))) + ) + + +def _is_shared_lib(file: str) -> bool: + return file.endswith((".so", ".dll", ".pyd"))