Skip to content

Investigate supporting newer pathlib.Path.match features #369

@james-garner-canonical

Description

@james-garner-canonical

Python 3.12 added support for pathlib.Path.match to accept a path-like object instead of just a string. Python 3.14 subtly adjusted the behaviour to also work for any object that implements with_segments, even if it isn't path-like.

Python 3.13 added the related method pathlib.Path.full_match.

We should investigate which (if any) of these changes charmlibs.pathops could (and should) support now, and clearly document when we should add support for other features.

The match behaviour change on Python 3.14 prompted the creation of this issue, as a ContainerPath will now be accepted at runtime by pathlib.PurePath.match, LocalPath.match, and ContainerPath.match. At the very least, ContainerPath.match should probably return False if the containers don't match, if not make it an error to use ContainerPath here since it isn't os.PathLike.

Metadata

Metadata

Assignees

No one assigned

    Labels

    26.10An item we hope to do in the 26.10 cyclecharmlibs-pathopsRelated to the charmlibs.pathops library specifically.docsImprovements or additions to documentationrainy daySmall items done in ~10% of each week's time

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions