datalad / datalad-catalog

Create a user-friendly data catalog from structured metadata
https://datalad-catalog.netlify.app
MIT License
15 stars 12 forks source link

ENH: replace use of `__file__` with `importlib.resources` #243

Closed jsheunis closed 3 months ago

jsheunis commented 1 year ago
          Note: using `importlib.resources` seems to be recommended over `__file__`; see explanation: [accessing data files at runtime](https://setuptools.pypa.io/en/latest/userguide/datafiles.html#accessing-data-files-at-runtime) in setuptools docs (also note that specific functions were backported under `importlib_resources` for python <3.9).

However, I'm no expert and only learned about this recently, so just sharing. __file__ works perfectly fine except some exotic situations. So feel free to disregard or relegate to an issue for the future.

_Originally posted by @mslw in https://github.com/datalad/datalad-catalog/pull/237#discussion_r1081602333_