Closed tijmenbaarda closed 10 months ago
Thanks for the PR and the library 👏 . Any chance to get it merged 🙏 ?
Any chance to get it merged 🙏 ?
@tijmenbaarda, thanks for your PR. Tests are successful for Python 3.8+.
I plan to take some time this weekend to determine if I can also cover Python 3.6 and Python 3.7. As iso639-lang
is downloaded 20,000 times a month from PyPI, I also have to make sure I don't break anything during the packaging process. I'll try to release the new version this weekend. Sorry to keep you waiting.
Thank yo @LBeaudoux 👏
Thank you @tijmenbaarda for reporting the compatibility issue with Python 3.12 and providing a solution. Your help was much appreciated.
Thanks a lot @LBeaudoux for your quick response! I will happily continue using iso639 in my projects :)
@LBeaudoux: now that I have imported the upgraded package in my project I see that Python 3.12 raises the following DeprecationWarning
, which I didn't see before unfortunately:
../.env/lib/python3.12/site-packages/iso639/datafile.py:6
/home/tijmen/p/lidia/lidia-browser/.env/lib/python3.12/site-packages/iso639/datafile.py:6: DeprecationWarning: 'importlib.abc.Traversable' is deprecated and slated for removal in Python 3.14
from importlib.abc import Traversable
This is because Traversable
has moved from importlib.abc
to importlib.resources.abc
in Python 3.11. This won't cause trouble until Python 3.14, but you may want to remove the return type hint of the get_file
function (and the Traversable
import) so that this warning won't show anymore and so that the code will continue to work from Python 3.14 onwards... Unfortunately changing the import to the new location would break compatibility with Python <3.11.
@tijmenbaarda thanks for reporting this DeprecationWarning
, Maybe we could keep the type hint and be Python 3.14+ ready by using the following imports:
try:
from importlib.resources import files
except ImportError:
# Compatibility for Python <3.9
from importlib_resources import files
try:
from importlib.resources.abc import Traversable
except ImportError:
try:
# Compatibility for Python 3.9 and 3.10
from importlib.abc import Traversable
except ImportError:
# Compatibility for Python <3.9
from importlib_resources.abc import Traversable
Sure! Although maybe that is overkill for a type hint for a private function, but that is up to you :)
maybe that is overkill for a type hint for a private function
You're right. I just removed the type hint and released v2.2.1.
Great! The warning does not appear anymore.
Use
importlib.resources.files
instead ofresource_filename
fromsetuptools
for accessing resource files, to assure compatibility with Python 3.12. In case of Python 3.8, the backport packageimportlib_resources
is used. Closes #16