Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
teald opened this issue Aug 6, 2024 · 0 comments
Open

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

teald opened this issue Aug 6, 2024 · 0 comments
Assignees
Labels
maintenance For maintenance tasks

Comments

@teald
Copy link
Member

teald commented Aug 6, 2024

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.
@teald teald added the maintenance For maintenance tasks label Aug 6, 2024
@teald teald self-assigned this Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance For maintenance tasks
Projects
None yet
Development

No branches or pull requests

1 participant