os.path gives cross-platform filesystem operations, but it's a cumbersome API because the primitive is a string. Since Python 3.4 pathlib has been available in the Python standard library, which makes some common filesystem operations available with better ergonomics.
Replace use of str paths with pathlib.Path and migrate away from os.path APIs to pathlib APIs. This can make the code much clearer in some cases.
Leave the code as is.
If this gets an OK from a maintainer, I'm happy to start working on this.
@myleott ?
Sounds good to me!
This can make the code much clearer in some cases.
What's an example?
One example is this. When I first read this when trying to debug #2847, I realized the semantics are ambiguous: this could refer to hidden files (i.e., ".model/") or relative paths specified a certain way (i.e, "./model/"). There are other fairly common ops like "path.suffix" which are logically used extensively to filter out certain extensions throughout the codebase. By adding a path object, we have a lot of flexibility by way of expressive semantics.
I'm happy to spin off a draft PR to see what the benefits actually look like. 馃槃
As an aside: this might also be a good opportunity to gradually add type hints to the code in hopes of catching more bugs with a linter and to generate better API docs.