Standardize path handling throughout the code base
As discussed with @edan-bainglass.
In PR #6255, an inconsistency in the type handling of the filepath_executable of PortableCode was identified by the introduction of pydantic (see here for reference).
Looking throughout the code base, we have two different type aliases for path-like types:
https://github.com/aiidateam/aiida-core/blob/660fec70ef43a64be7edae3c12f0a0fd5ef84349/src/aiida/transports/transport.py#L27
https://github.com/aiidateam/aiida-core/blob/660fec70ef43a64be7edae3c12f0a0fd5ef84349/src/aiida/repository/repository.py#L15
FilePath also here:
https://github.com/aiidateam/aiida-core/blob/660fec70ef43a64be7edae3c12f0a0fd5ef84349/src/aiida/orm/nodes/data/folder.py#L26
https://github.com/aiidateam/aiida-core/blob/660fec70ef43a64be7edae3c12f0a0fd5ef84349/src/aiida/orm/nodes/data/singlefile.py#L25
As well as standard type hints for paths, and combinations of the two: https://github.com/aiidateam/aiida-core/blob/660fec70ef43a64be7edae3c12f0a0fd5ef84349/src/aiida/repository/repository.py#L483
While I wouldn't deem this super high priority, it might be useful to standardize those path-like annotations if possible, or at least put them in a dedicated module, e.g., aiida/common/types.py. Also, many (probably older) parts of the codebase use os.path (this is especially prevalent in the transport plugins), where we could also consider switching to pathlib at some point.
Hi @GeigerJ2 , I'd like to work on this issue. Please let me know if there are any specific guidelines you'd like me to follow while making these changes.
Thanks!
@GeigerJ2 , I’ve opened a PR addressing this issue. Could you please review it?