Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make pathlib ABCs usable by zipfile.Path #128520

Open
1 of 10 tasks
barneygale opened this issue Jan 5, 2025 · 0 comments
Open
1 of 10 tasks

Make pathlib ABCs usable by zipfile.Path #128520

barneygale opened this issue Jan 5, 2025 · 0 comments
Labels
stdlib Python modules in the Lib dir topic-pathlib

Comments

@barneygale
Copy link
Contributor

barneygale commented Jan 5, 2025

Feature or enhancement

This issue covers the final tasks needed to make the pathlib ABCs worthy of using in zipfile.Path (i.e. zipp.Path).

Tasks

Discussion: https://discuss.python.org/t/make-pathlib-extensible/3428

Linked PRs

@barneygale barneygale added type-feature A feature request or enhancement topic-pathlib and removed type-feature A feature request or enhancement labels Jan 5, 2025
barneygale added a commit to barneygale/cpython that referenced this issue Jan 5, 2025
In the private pathlib ABCs, rename `PurePathBase` to `JoinablePath`, and
split `PathBase` into `ReadablePath` and `WritablePath`. This improves the
API fit for read-only virtual filesystems.

The split of `PathBase` entails a similar split of `CopyWorker` (implements
copying) and the test cases in `test_pathlib_abc`. For a couple of reasons,
this isn't quite possible yet.

In a later patch, we'll make `WritablePath` inherit directly from
`JoinablePath` rather than `ReadablePath`.
barneygale added a commit to barneygale/cpython that referenced this issue Jan 5, 2025
In the private pathlib ABCs, rename `PurePathBase` to `JoinablePath`, and
split `PathBase` into `ReadablePath` and `WritablePath`. This improves the
API fit for read-only virtual filesystems.

The split of `PathBase` entails a similar split of `CopyWorker` (implements
copying) and the test cases in `test_pathlib_abc`. For a couple of reasons,
this isn't quite possible yet.

In a later patch, we'll make `WritablePath` inherit directly from
`JoinablePath` rather than `ReadablePath`.
@barneygale barneygale changed the title Prepare pathlib ABCs for PEP Make pathlib ABCs usable by zipfile.Path Jan 5, 2025
@picnixz picnixz added stdlib Python modules in the Lib dir type-feature A feature request or enhancement and removed type-feature A feature request or enhancement labels Jan 6, 2025
barneygale added a commit that referenced this issue Jan 11, 2025
In the private pathlib ABCs, rename `PurePathBase` to `JoinablePath`, and
split `PathBase` into `ReadablePath` and `WritablePath`. This improves the
API fit for read-only virtual filesystems.

The split of `PathBase` entails a similar split of `CopyWorker` (implements
copying) and the test cases in `test_pathlib_abc`.

In a later patch, we'll make `WritablePath` inherit directly from
`JoinablePath` rather than `ReadablePath`. For a couple of reasons,
this isn't quite possible yet.
barneygale added a commit to barneygale/cpython that referenced this issue Jan 11, 2025
Convert `JoinablePath`, `ReadablePath` and `WritablePath` to real ABCs
derived from `abc.ABC`.

Make `JoinablePath.parser` abstract, rather than defaulting to `posixpath`.

Register `PurePath` and `Path` as virtual subclasses of the ABCs rather
than deriving. This avoids a hit to path object instantiation performance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir topic-pathlib
Projects
None yet
Development

No branches or pull requests

2 participants