Make pathlib extensible (original) (raw)

June 16, 2023, 6:28pm 109

✨ June 2023 progress report ✨

My revised target for adding pathlib.AbstractPath and tarfile.TarPath is Python 3.13. I have a plan and working (local) implementations of both :slight_smile:

An inheritance diagram, with new classes in yellow:

image

There are 2-3 more PRs I need to land before I add AbstractPath:

  1. GH-104810: Add pathlib._BasePurePath (thanks Alex and Éric for the reviewing!)
  2. GH-105794: Add follow_symlinks argument to pathlib.Path.is_dir() and is_file()
  3. (Probably) final pass of pathlib.Path tests

(Reviews appreciated as ever!)

The tarfile.TarPath class will follow soon after AbstractPath is added. The implementation is short and sweet, which is nice and helps validate the AbstractPath design, but I have a lot of tests to write! :sweat_smile:

The AbstractPath class name will initially have an underscore prefix. I’ll solicit feedback from maintainers of pathlib-y pypi packages, make any adjustments, and hopefully drop the prefix in time for 3.13 beta 1.

That’s all. Ciao for now!