Repository navigation
Allow walk to take an integer depth - #111
Merged
Merged
Conversation
Project(walk=N) and Project.resolve(walk=N) now descend at most N directory levels below the root; True still walks the whole tree, False/0 never descends and None keeps the current behaviour. Negative or non-integer values raise ValueError. Closes fsspec#69
anyingiit
force-pushed
the
walk-int-depth
branch
from
September 25, 2026 03:49
f5313d3 to
0d29a3d
Compare
Contributor
Author
|
Thanks! Both done in 809fee8: the type guard (and its test) is gone, and the child's walk value is now computed inline where the child project is created. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Project(walk=...)(andProject.resolve(walk=...)) now also accepts a non-negative integer,giving the maximum number of directory levels to descend below the root, as proposed in #69:
walk=True– walk the whole tree (unchanged)walk=False/walk=0– never descend (unchanged forFalse)walk=None(default) – descend one level only if the root matched no spec (unchanged)walk=N– descend at mostNlevels; each child is scanned withN - 1Because
boolis a subclass ofint, booleans are handled first. There is no extra validation ofthe value (per review). The two TODO comments about an integer walk are removed,
scan_glob's type hint/docstring is updated (it passeswalkstraight through), and the intro docsmention
walk=2. A directory without any spec still counts as one level (its matches show up as"dir/sub"children as before).I did not change the CLI (
--walkis still a flag) or switch to fsspec's depth-first walk for earlypruning (the "possible addition" in the issue) — happy to follow up on either if wanted.
Motivation / disclosure: I had some spare AI-assistant quota (Claude Code) and am using it to try to
help projects with open good-first-issues. The change was prepared with Claude Code and verified as listed
below. If it doesn't fit, isn't up to your bar, or you'd simply rather not take it — please feel free to
close it, no hard feelings at all 🙂
Related issue
Closes #69
Checklist
pip install -e .[test],pytest -q: 589 passed, 16 skipped, withcargoon PATH for the Rust round-trip tests; with the source reverted tomain,pytest tests/test_basic.py -k walkgives 3 failed, 7 passed (the integer-depth cases);pre-commit runon the changed files passes)CHANGELOG.mdis updated (if applicable) — n/a (the repo has no changelog)Project,Project.resolve,scan_glob, anddocs/source/intro.rst