Skip to content

Achieve parity with globbing functionality in Python >= 3.13 #479

Open
@pjbull

Description

@pjbull

There are a few limitations to our current implementation for glob in newer versions of Python. In #474, we introduced cloupathlib/legacy/glob.py that has CPython code that was removed in 3.13, but we need for globbing.

This also means that there is no good way to implement parity with the behavior in 3.13 that globbing with a pattern that ends with “**” returns both files and directories. In previous versions, only directories were returned. Our current implementation does not have parity; if you add a test for path.glob("**") because Python 3.13 in this instance returns the directory path represents and we don't.

We should update our glob implementation in the following ways:

  • Use the new glob.translate for our glob implementation if Python version supports it (and maybe even backport).
  • Remove the vendored CPython code in cloupathlib/legacy/glob.py
  • Fix the mismatch with patterns ending in ** discussed above

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions