As per documentation, BIDSPath is already closely related to pathlib.Path and inherently represents a path
BIDSPath allows dynamic updating of its entities in place, and operates similar to pathlib.Path.
As it is not recognized as a Path or os.PathLike, many libraries do not accept it as an argument for a filepath (e.g. see joblib/joblib#1784). It might be useful to indicate to other libraries "this is a Path!".
I understand that subtyping pathlib.Path might not be a good idea, so maybe implementing os.PathLike protocol to indicate to other libraries "Hey, this is a path!"? Or is there a reason not to do that?
apparently, this is as simple as
def __fspath__(self):
return str(self.fpath)
As per documentation, BIDSPath is already closely related to
pathlib.Pathand inherently represents a pathAs it is not recognized as a
Pathoros.PathLike, many libraries do not accept it as an argument for a filepath (e.g. see joblib/joblib#1784). It might be useful to indicate to other libraries "this is a Path!".I understand that subtyping
pathlib.Pathmight not be a good idea, so maybe implementingos.PathLikeprotocol to indicate to other libraries "Hey, this is a path!"? Or is there a reason not to do that?apparently, this is as simple as