openzim / python-libzim

Libzim binding for Python: read/write ZIM files in Python
https://pypi.org/project/libzim/
GNU General Public License v3.0
62 stars 20 forks source link

we should accept pathlib.Path #45

Closed rgaudin closed 4 years ago

rgaudin commented 4 years ago

With the general move in the stdlib to accept pathlib.Path for all path-related operations, it seems a little odd and dated to have to to send str to the libzim.

I'd like to harmonize with this move so that the Creator and File can take both str and Path and we'd check the type in the python wrapper and converts it to str for the binding.

I shall mention that functions usually returns same type as provided. We only output path for File.filename I think. We would acknowledge that we'd still return str here (otherwise we'd have to store the type info in the wrapper)

mgautierfr commented 4 years ago

Yes we should. pathlib is good. I personally tend to prefer manipulate all the time Path when we are manipulate path. I would said that we should take Path by "default" and convert str to path if needed. (And so return a Path for the getfilename function). And convert to str/bytes when passing the value to the cpp world.