Skip to content

[OTHER] Update os.path to pathlib.Path #45

Description

@teald

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions