Skip to content

Add pathlib-compatible recursive globbing - #278

Open
zhou-jianwen wants to merge 1 commit into
jaraco:mainfrom
zhou-jianwen:codex/path-rglob
Open

zhou-jianwen wants to merge 1 commit into
jaraco:mainfrom
zhou-jianwen:codex/path-rglob

Conversation

@zhou-jianwen

Copy link
Copy Markdown

Add Path.rglob(pattern) for recursive path discovery, addressing the rglob item in #214.

Delegate matching to the host platform's pathlib.Path.rglob and lazily convert results through the captured _next_class. This preserves ordinary subclasses and TempDir's conversion to Path. Document hidden-entry matching, host case/separator semantics and the distinction between recursive directory-symlink traversal and an explicitly named symlink segment. Existing glob and iglob behavior is unchanged; their documentation points to the new method.

Validation:

  • Python 3.10.22 and 3.14.10 primary tox environments: 177 passed, 1 skipped each, including formatting, lint and mypy. Unmodified Python 3.14 baseline: 164 passed, 1 skipped.
  • All 13 added regression cases fail against the original source and pass with the implementation. They cover nested/hidden matches, literal brackets in the root, nonmatches, multi-segment patterns, observable filesystem laziness, subclasses, direct TempDir use, custom-module host semantics and directory symlinks.
  • Strict Sphinx build and sphinxlint pass. The Towncrier draft includes the new fragment with Maximize compatibility with pathlib.Path #214; NEWS.rst is unchanged. git diff --check passes.

Local verification was on macOS arm64; hosted platform checks remain to be run.

AI assistance: OpenAI Codex was used for implementation, tests and automated review.

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.

1 participant