-
-
Notifications
You must be signed in to change notification settings - Fork 34.5k
Type hints for pathlib.types #130798
Copy link
Copy link
Open
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-pathlibtopic-typingtype-featureA feature request or enhancementA feature request or enhancement
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-pathlibtopic-typingtype-featureA feature request or enhancementA feature request or enhancement
Feature or enhancement
The
pathlib.typesmodule is new in 3.14, and contains a single public class:pathlib.types.PathInfo.This module also contains a few private classes:
_PathParser,_JoinablePath,_ReadablePathand_WritablePath.As the
pathlib.typesmodule is not imported bypathlib, I think we're free to add proper type annotations to the entire module, including the private classes. I think this will help clarify the interface.I'd like these hints to be compatible with the oldest version of Python still receiving security updates (3.9 at time of writing) because I'm hoping to provide a PyPI package from this module.
Linked PRs