Thanks so much to everyone who discussed and reviewed the code and made suggestions.

The bulk of these patches have now landed. For those following along at home, here’s a summary of the remaining PRs/bugs :

I believe this is a complete account of the outstanding prep work. Once these land, pathlib’s path, flavour and accessor abstractions will be less leaky, which allows work on pathlib.AbstractPath to proceed.

Thanks again to Antoine Pitrou, Brett Cannon, Serhiy Storchaka, Steve Dower and Eryk Sun for their invaluable contributions.

Barney


On Sat, 3 Apr 2021 at 03:02, Barney Gale <barney.gale@gmail.com> wrote:

I’m working towards supporting subclassing pathlib.Path for things like zip/tar archives, iso files, S3, etc. This was first brought up a few years ago in bpo-24132 and discussed further on the python-ideas forum.

Before I can approach the meat of the issue, I'd like to land a handful of backwards-compatible patches that tidy up the pathlib internals. These are:

  • #19220 / bpo-39924: Handle missing os functions more consistently in pathlib
  • #18838 / bpo-39895: Move pathlib.Path.touch() implementation into the path accessor
  • #19342 / bpo-40038: Remove partial support for preserving accessor when modifying a path
  • #18841 / bpo-39899: Make pathlib use os.path.expanduser() to expand home directories
  • #18834 / bpo-39659: Route calls from pathlib.Path to os.getcwd() via the path accessor
  • #18864 / bpo-39906: Add follow_symlinks parameter to pathlib.Path.stat() and chmod()
  • #24294 / bpo-42999: Expand and clarify pathlib.Path.link_to() documentation

Could I please request review of these patches? A couple may already be ready to land.

(I appreciate they’re a little dry. This is all prep work for the introduction of a shiny new class, tentatively named ‘AbstractPath’).

Thanks!

Barney