From 0027072f7a7dc9d7993fb7ff1b3f36765535d031 Mon Sep 17 00:00:00 2001 From: gmweaver Date: Tue, 26 Aug 2025 21:19:36 -0700 Subject: [PATCH 1/2] pass anon explicitly to s3fs.S3FileSystem --- pyiceberg/io/fsspec.py | 6 ++++-- tests/io/test_fsspec.py | 5 ++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pyiceberg/io/fsspec.py b/pyiceberg/io/fsspec.py index 8c8f6936ce..310402645a 100644 --- a/pyiceberg/io/fsspec.py +++ b/pyiceberg/io/fsspec.py @@ -168,9 +168,11 @@ def _s3(properties: Properties) -> AbstractFileSystem: config_kwargs["read_timeout"] = float(request_timeout) if s3_anonymous := properties.get(S3_ANONYMOUS): - config_kwargs["anon"] = strtobool(s3_anonymous) + anon = strtobool(s3_anonymous) + else: + anon = False - fs = S3FileSystem(client_kwargs=client_kwargs, config_kwargs=config_kwargs) + fs = S3FileSystem(anon=anon, client_kwargs=client_kwargs, config_kwargs=config_kwargs) for event_name, event_function in register_events.items(): fs.s3.meta.events.unregister(event_name, unique_id=1925) diff --git a/tests/io/test_fsspec.py b/tests/io/test_fsspec.py index 11b168dc16..34e3616fa6 100644 --- a/tests/io/test_fsspec.py +++ b/tests/io/test_fsspec.py @@ -284,6 +284,7 @@ def test_fsspec_s3_session_properties_with_anonymous() -> None: s3_fileio.new_input(location=f"s3://warehouse/{filename}") mock_s3fs.assert_called_with( + anon=True, client_kwargs={ "endpoint_url": "http://localhost:9000", "aws_access_key_id": "admin", @@ -291,9 +292,7 @@ def test_fsspec_s3_session_properties_with_anonymous() -> None: "region_name": "us-east-1", "aws_session_token": "s3.session-token", }, - config_kwargs={ - "anon": True, - }, + config_kwargs={}, ) From a43073c7e974ed83a4bc34e28b6bc965da6508d5 Mon Sep 17 00:00:00 2001 From: gmweaver Date: Wed, 27 Aug 2025 05:44:30 -0700 Subject: [PATCH 2/2] fix unit tests --- tests/io/test_fsspec.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/io/test_fsspec.py b/tests/io/test_fsspec.py index 34e3616fa6..e03310cb55 100644 --- a/tests/io/test_fsspec.py +++ b/tests/io/test_fsspec.py @@ -255,6 +255,7 @@ def test_fsspec_s3_session_properties() -> None: s3_fileio.new_input(location=f"s3://warehouse/{filename}") mock_s3fs.assert_called_with( + anon=False, client_kwargs={ "endpoint_url": "http://localhost:9000", "aws_access_key_id": "admin", @@ -309,6 +310,7 @@ def test_fsspec_unified_session_properties() -> None: s3_fileio.new_input(location=f"s3://warehouse/{filename}") mock_s3fs.assert_called_with( + anon=False, client_kwargs={ "endpoint_url": "http://localhost:9000", "aws_access_key_id": "client.access-key-id",