Sorry to be so late to the party here, but just throwing my 2 cents that the easiest way to make pathlib.Path extensible is to make it inherit from WindowsPath or PosixPath at definition time.
Currently which of WindowsPath and PosixPath to use is decided at instantiation time, which is wholly unnecessary because os.name is never going to change for the life of the program.
So the new class hierarchy should look like this:
class PathBase(PurePath):
... # I/O methods
class WindowsPath(PathBase, PureWindowsPath):
...
class PosixPath(PathBase, PurePosixPath):
...
class Path(WindowsPath if os.name == 'nt' else PosixPath):
pass
This way, a user class inheriting from Path will never be missing a _flavour attribute.
I have a working demo in Is there a pathlib equivalent of os.scandir()? if anyone’s interested.