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

enhancement/refactor: path handling #81

Open
benatouba opened this issue Nov 26, 2024 · 1 comment
Open

enhancement/refactor: path handling #81

benatouba opened this issue Nov 26, 2024 · 1 comment

Comments

@benatouba
Copy link
Contributor

benatouba commented Nov 26, 2024

The file handling via the os.path module comes with several pitfalls, especially when dealing with both UNIX-pathand ntppathstyles. I am not sure if COSIPY is supposed to run on windows as well, but do you see a benefit in refactoring the code to use pathlib module's Path and PurePath classes for path-handling.

It is encouraged to be used anyway, yields better type hinting, offers more flexibility with different systems and is arguably a bit prettier to write.

P.S.: I can't add labels to issues.

benatouba added a commit to benatouba/cosipy that referenced this issue Nov 26, 2024
Transform all path variables to the more modern `pathlib.Path` object.
This helps with cross-platform compatibility and makes the code more
readable.

Some type annotations were also passed.
Meant to be applied in conjunction with a move to Pydantic for configuration validation.

NOTE: If cherry-picked, needs to be revised carefully as the commit is
meant to be applied with a move to Pydantic.

Fixes cryotools#81
@gampnico
Copy link
Collaborator

Links to #86.

benatouba added a commit to benatouba/cosipy that referenced this issue Nov 29, 2024
Transform all path variables to the more modern `pathlib.Path` object.
This helps with cross-platform compatibility and makes the code more
readable.

Some type annotations were also passed.
Meant to be applied in conjunction with a move to Pydantic for configuration validation.

NOTE: If cherry-picked, needs to be revised carefully as the commit is
meant to be applied with a move to Pydantic.

Fixes cryotools#81
benatouba added a commit to benatouba/cosipy that referenced this issue Nov 29, 2024
Transform all path variables to the more modern `pathlib.Path` object.
This helps with cross-platform compatibility and makes the code more
readable.

Some type annotations were also passed.
Meant to be applied in conjunction with a move to Pydantic for configuration validation.

NOTE: If cherry-picked, needs to be revised carefully as the commit is
meant to be applied with a move to Pydantic.

Fixes cryotools#81
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants