fsspec / fsspec/filesystem_spec

Why are find/glob functions not lazy?

Open
#574 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.4k
Forks
490
Avg merge
2d 3h
Merged PRs (30d)
38

Description

Hello,

For example, I have a directory with subdirectories and a lot of files (tens/hundreds of millions total, tens of thousands in each directory). I want to read/process these files in parallel long hours and days. I want to select files by glob and pass paths to the workers through a queue for example. And I cannot use fsspec glob for this, because it is not a lazy function. Yes, I know about fsspec walk but I would use glob recursive pattern, something like this:

for path in fs.glob('/path/to/root/**.xml')
    queue.put(path)

I can make it with pathlib.Path.rglob for local, because it is a lazy function and it does not return a huge list of million files. However I cannot make it with an abstract filesystem via fsspec glob.

Is there a way to make these functions lazy or it is hard/impossible within the current design?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the fsspec glob and walk entry points, then compare their behavior with pathlib.Path.rglob for the recursive pattern described. Determine whether a lazy glob interface fits the current filesystem design; done means callers can consume matching paths incrementally without materializing the full result.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.