GreenBankObservatory/dysh

use of pathlib.Path vs. os.path.... and friends?

Opened this issue · 3 comments

Feature description
In some places in dysh we've been using pathlib.Path(), but going through my new dysh_data I realize if we should or should not make this a standard. Either use one or the other, but not both. If I change dysh_data to use pathlib, that's a lot of code changes, so i need guidance before I make that change.

Solution
Looking for opinions, or is the use of windows the dealbreaker?

when converting dysh_data() it turns out pytest was very picky when I catenated 3 elements, of which only the first one with a Path but the 2nd and 3rd a string, forcing me to say

    dysh_data / Path('sdfits')  / sdfits

I encountered this when writing the tests for the notebooks. What works for me is to define paths based on Path.cwd(). Can you provide more details about which paths you've defined, which path definitions failed, where I can find them in the code, and the relevant failed GitHub Action?

Unable to reproduce (on Linux at least):

In [6]: from pathlib import Path, PureWindowsPath

In [7]: PureWindowsPath(".") / "foo" / "bar"
Out[7]: PureWindowsPath('foo/bar')

In [8]: Path(".") / "foo" / "bar"
Out[8]: PosixPath('foo/bar')