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

PYIODE: support Path objects for filepath argument everywhere #555

Open
6 tasks
alixdamman opened this issue May 24, 2024 · 1 comment
Open
6 tasks

PYIODE: support Path objects for filepath argument everywhere #555

alixdamman opened this issue May 24, 2024 · 1 comment
Assignees
Labels
difficulty: low enhancement New feature or request good first issue Good for newcomers python Python binding for IODE

Comments

@alixdamman
Copy link
Collaborator

alixdamman commented May 24, 2024

@yvdabb You may want to work on this. First:

  • import Path from pathlib in the main file iode_python.pyx

Then, in every method/functions having a filename or a filepath argument in pyiode, you have to do:

  • update the type hints of the argument filename/filepath (something like filename/filepath: Union[str, Path])
  • update the accepted types for filename/filepath in the list of Parameters in the function/method documentation (filename/filepath: str or Path)
  • in the body of the function/method, check that the type of the passed value for filename/filepath is either str or Path (isisinstance(filename/filepath, (str, Path))
  • if filename/filepath is of type PATH (isinstance(filename/filepath, Path):), convert it to an absolute path as string (I think the method is 'resolve()') -> check documentation of pathlib
  • check if the file exist -> if not file.exists(): raise ValueError(...)

See for example Variables.low_to_high() and Variables.high_to_low() methods

@alixdamman alixdamman added enhancement New feature or request good first issue Good for newcomers python Python binding for IODE difficulty: low labels May 24, 2024
@yvdabb
Copy link
Collaborator

yvdabb commented Aug 8, 2024

FYI, I just created a yvda_python_path_objects branch and will follow up on the above issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: low enhancement New feature or request good first issue Good for newcomers python Python binding for IODE
Projects
None yet
Development

No branches or pull requests

2 participants