sentinel-energy / friendly_data

Data format to interoperate between models and frameworks
https://sentinel-energy.github.io/friendly_data/
Apache License 2.0
11 stars 3 forks source link

Platform independent path comparison #17

Open suvayu opened 3 years ago

suvayu commented 3 years ago

The datapackage spec requires all paths in the package metadata to be POSIX paths, however the implementation doesn't enforce this in a platform independent manner, so some functions when run on Window can generate path strings like "path_to\\data.csv". This poses two problems:

  1. corrupt/non-conformant package metadata maybe written
  2. path comparisons may fail on some OS combinationss (when package creation and the path comparison are not happening on the same OS).

Two separate resolutions are required:

olejandro commented 2 years ago

@suvayu, it seems that ensuring POSIX causes dpkg.read_pkg() to fail on datapackages with inline data (and therefore no path specified). Here is an example: https://github.com/MaREI-EPMG/ireland-carbon-budget-scenarios-2021/security

suvayu commented 2 years ago

I'm not surprised since I never tested with inline data :(. Do you get KeyError of some kind?

I'm employed elsewhere now, so I need to find some free time outside of work to fix this. Probably not a big fix though.

olejandro commented 2 years ago

Thanks a lot! yes, it is complaining that path is missing. I've just submitted a pull request removing a windows specific check for posix. It seems no longer needed (?)

suvayu commented 2 years ago

Hi @olejandro I fixed the issue with #26, please have a look if it works for you.