Skip to content

Fix HfPath.iterdir on a namespace with recent huggingface_hub - #563

Open
itzzdev09 wants to merge 1 commit into
fsspec:mainfrom
itzzdev09:fix-hf-iterdir-namespace
Open

itzzdev09 wants to merge 1 commit into
fsspec:mainfrom
itzzdev09:fix-hf-iterdir-namespace

Conversation

@itzzdev09

Copy link
Copy Markdown

Fixes #562.

Recent huggingface_hub releases reject a single-segment repository id with a ValueError ("Repository id must be 'namespace/name'…") where older versions raised NotImplementedError. HfPath.iterdir only translated NotImplementedError into UnsupportedOperation, so iterating a namespace such as a user (test_iterdir_parent_iteration) now leaked the ValueError and the test failed.

This catches both, so the behaviour is the same on old and new huggingface_hub.

Tested with huggingface_hub 1.31.0: test_hf.py went from 1 failed / 96 passed to all passing, and test_hf.py, test_memory.py, test_local.py together pass (478 passed).

AI disclosure: made with Claude Code under my supervision; I reviewed the change and ran the tests locally.

🤖 Generated with Claude Code

…ted in HfPath.iterdir

Newer huggingface_hub releases raise ValueError instead of
NotImplementedError when asked to list a namespace such as a user's
repositories, which made test_iterdir_parent_iteration fail.

Fixes fsspec#562

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

Incompatibility with recent huggingface-hub

1 participant