os.path (and related utilities from the os module) should be replaced by pathlib.Path and its higher-level API where performance is not a concern.
Notes
- As far as I know there are not issue with performance related to this. In other words, there is no place where
os.path is used that using Path/its API instead would incur noticeable performance costs.
- In cases where that may be the case, it's almost always the case the
os.path is being called on a path string that is usually using os.path.join anyways.
- In some cases, this can be extracted from loops (examples?).
- I'm unsure if performance is still a concern here; the bottom line is that
Path is easier to support than str + os.path.
- This can be enabled as a
ruff linter ruleset (PTH), which is currently disabled.
os.path(and related utilities from theosmodule) should be replaced bypathlib.Pathand its higher-level API where performance is not a concern.Notes
os.pathis used that usingPath/its API instead would incur noticeable performance costs.os.pathis being called on a path string that is usually usingos.path.joinanyways.Pathis easier to support thanstr+os.path.rufflinter ruleset (PTH), which is currently disabled.