Skip to content

Parse adls.anon as a boolean in FsspecFileIO - #4154

Closed
kevinjqliu wants to merge 1 commit into
apache:mainfrom
kevinjqliu:kevinjqliu-adls-anon-boolean-fix
Closed

kevinjqliu wants to merge 1 commit into
apache:mainfrom
kevinjqliu:kevinjqliu-adls-anon-boolean-fix

Conversation

@kevinjqliu

@kevinjqliu kevinjqliu commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Rationale for this change

Follow-up to #2661, which added adls.anon.

adls.anon is passed to adlfs as-is. Config from .pyiceberg.yaml and PYICEBERG_* env vars is always a string, so adls.anon: false reaches adlfs as "false". adlfs expects a bool (anon: bool = None) and only uses DefaultAzureCredential when anon is False. "false" is not False, so default credentials are skipped and requests go out anonymously.

This parses adls.anon with property_as_bool. When unset, it still passes None so adlfs falls back to its default and AZURE_STORAGE_ANON.

adls.anon main This PR
"false" (YAML or env var) anonymous DefaultAzureCredential
False (Python) DefaultAzureCredential DefaultAzureCredential
"true" / True anonymous anonymous
unset adlfs default adlfs default
"maybe" anonymous ValueError

Are these changes tested?

Yes, test_adls_anon_parsed_as_bool covers the cases above and fails on main.

  • uv run python -m pytest tests/io/test_fsspec.py -k "anon_parsed or adls_account_name or adls_does_not_mutate": 6 passed
  • Fabric OneLake with adls.anon=false and an az login session: main sends an unauthenticated request, this PR authenticates

Are there any user-facing changes?

Yes, bug fix. adls.anon=false set from config now uses DefaultAzureCredential instead of anonymous access. Invalid values now raise ValueError.

AI Disclosure: Assisted by GitHub Copilot.

Copilot AI balanced review requested due to automatic review settings October 25, 2026 04:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Explicit boolean False becomes None, allowing environment settings to override the requested authentication mode.

1 open issue
What changed in this PR

This PR corrects string parsing for adls.anon in FsspecFileIO, supporting the default-credential configuration introduced in #2661.

Changes:

  • Parse configured adls.anon strings as booleans while retaining None when unset.
  • Add regression coverage for "false" and "true".
File Description
tests/​io/​test_fsspec.py Tests boolean values passed to adlfs from string configuration.
pyiceberg/​io/​fsspec.py Uses property_as_bool for the anonymous-access option.

Review effort: Balanced

Comment thread pyiceberg/io/fsspec.py Outdated
@kevinjqliu
kevinjqliu marked this pull request as draft October 25, 2026 04:12
adls.anon was passed to adlfs as a string, and adlfs only uses default
credentials when anon is False, so "false" silently disabled them.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@kevinjqliu
kevinjqliu force-pushed the kevinjqliu-adls-anon-boolean-fix branch from 537ce44 to 7ba06d8 Compare October 25, 2026 04:19
@kevinjqliu kevinjqliu closed this Oct 25, 2026
@kevinjqliu
kevinjqliu deleted the kevinjqliu-adls-anon-boolean-fix branch October 25, 2026 04:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants