Kozea/tinycss2

Avoid use of __file__

jayvdb opened this issue · 3 comments

It appears the use of __file__ here is mostly unnecessary, and can easily be replaced with importlib.resources/pkgutil.get_data. See indygreg/PyOxidizer#69 for more info about why, but the tl;dr version is __file__ is an optional attribute and should not be relied upon.

Currently it is only needed for loading VERSION, for which importlib.resources/pkgutil.get_data are ideal.

snodo commented

I also ran into trouble with this because the current implementation is not compatible with py2exe.

While it is only used to get the VERSION, I hardcoded the version string as a workaround in my installation.

Thanks for the awesome library. ❤️
I can confirm that #27 fixes this issue that https://github.com/gaphor/gaphor has packaging with pyinstaller.

Congrats on the big update, I'm excited about the next release! 🎉