Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(python): Automatically use boto3 / google-auth if installed when scanning cloud #19677

Merged
merged 4 commits into from
Nov 7, 2024
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
2 changes: 1 addition & 1 deletion py-polars/polars/io/csv/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ def scan_csv(
decimal_comma: bool = False,
glob: bool = True,
storage_options: dict[str, Any] | None = None,
credential_provider: CredentialProviderFunction | Literal["auto"] | None = None,
credential_provider: CredentialProviderFunction | Literal["auto"] | None = "auto",
retries: int = 2,
file_cache_ttl: int | None = None,
include_file_paths: str | None = None,
Expand Down
2 changes: 1 addition & 1 deletion py-polars/polars/io/ipc/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ def scan_ipc(
row_index_name: str | None = None,
row_index_offset: int = 0,
storage_options: dict[str, Any] | None = None,
credential_provider: CredentialProviderFunction | Literal["auto"] | None = None,
credential_provider: CredentialProviderFunction | Literal["auto"] | None = "auto",
memory_map: bool = True,
retries: int = 2,
file_cache_ttl: int | None = None,
Expand Down
4 changes: 2 additions & 2 deletions py-polars/polars/io/ndjson.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def read_ndjson(
row_index_offset: int = 0,
ignore_errors: bool = False,
storage_options: dict[str, Any] | None = None,
credential_provider: CredentialProviderFunction | Literal["auto"] | None = None,
credential_provider: CredentialProviderFunction | Literal["auto"] | None = "auto",
retries: int = 2,
file_cache_ttl: int | None = None,
include_file_paths: str | None = None,
Expand Down Expand Up @@ -206,7 +206,7 @@ def scan_ndjson(
row_index_offset: int = 0,
ignore_errors: bool = False,
storage_options: dict[str, Any] | None = None,
credential_provider: CredentialProviderFunction | Literal["auto"] | None = None,
credential_provider: CredentialProviderFunction | Literal["auto"] | None = "auto",
retries: int = 2,
file_cache_ttl: int | None = None,
include_file_paths: str | None = None,
Expand Down
4 changes: 2 additions & 2 deletions py-polars/polars/io/parquet/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def read_parquet(
rechunk: bool = False,
low_memory: bool = False,
storage_options: dict[str, Any] | None = None,
credential_provider: CredentialProviderFunction | Literal["auto"] | None = None,
credential_provider: CredentialProviderFunction | Literal["auto"] | None = "auto",
retries: int = 2,
use_pyarrow: bool = False,
pyarrow_options: dict[str, Any] | None = None,
Expand Down Expand Up @@ -338,7 +338,7 @@ def scan_parquet(
low_memory: bool = False,
cache: bool = True,
storage_options: dict[str, Any] | None = None,
credential_provider: CredentialProviderFunction | Literal["auto"] | None = None,
credential_provider: CredentialProviderFunction | Literal["auto"] | None = "auto",
retries: int = 2,
include_file_paths: str | None = None,
allow_missing_columns: bool = False,
Expand Down
7 changes: 7 additions & 0 deletions py-polars/tests/unit/io/cloud/test_cloud.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from functools import partial

import pytest

import polars as pl
Expand All @@ -11,6 +13,11 @@ def test_scan_nonexistent_cloud_path_17444(format: str) -> None:

path_str = f"s3://my-nonexistent-bucket/data.{format}"
scan_function = getattr(pl, f"scan_{format}")
# Prevent automatic credential provideder instantiation, otherwise CI may fail with
# * pytest.PytestUnraisableExceptionWarning:
# * Exception ignored:
# * ResourceWarning: unclosed socket
scan_function = partial(scan_function, credential_provider=None)

# Just calling the scan function should not raise any errors
if format == "ndjson":
Expand Down