DeepLcom / deepl-python

Official Python library for the DeepL language translation API.
MIT License
1.06k stars 75 forks source link

`packaging` not defined as dependency in version 1.16.0 #81

Closed timobrembeck closed 8 months ago

timobrembeck commented 8 months ago

Not sure if it's a problem of my environment, but when I install deepl==1.16.0, it does not automatically install the packaging dependency as well, which is used since 6fe6c24247391ae42baf31d77bf8fdccab913cea.

cd /tmp python -m venv .venv source .venv/bin/activate pip install deepl

Collecting deepl
[...]
Installing collected packages: urllib3, idna, charset-normalizer, certifi, requests, deepl
Successfully installed certifi-2023.7.22 charset-normalizer-3.3.2 deepl-1.16.0 idna-3.4 requests-2.31.0 urllib3-2.0.7

python --version

Python 3.11.5

pip --version

pip 23.2.1 from /tmp/.venv/lib/python3.11/site-packages/pip (python 3.11)

python -m deepl

Traceback (most recent call last):
  File "<frozen runpy>", line 189, in _run_module_as_main
  File "<frozen runpy>", line 148, in _get_module_details
  File "<frozen runpy>", line 112, in _get_module_details
  File "/tmp/.venv/lib/python3.11/site-packages/deepl/__init__.py", line 20, in <module>
    from . import http_client  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/.venv/lib/python3.11/site-packages/deepl/http_client.py", line 17, in <module>
    from packaging import version as packaging_version_module
ModuleNotFoundError: No module named 'packaging'
JanEbbing commented 8 months ago

I can reproduce this, thanks for the report. Looking into a fix.

daniel-jones-deepl commented 8 months ago

Workaround: install packaging manually using pip install packaging.

JanEbbing commented 8 months ago

Fixed in v1.16.1 We will likely yank v1.16.0 tomorrow. I also wrote a test for our CI that should catch something like this in the future. (packaging is a dependency of poetry and as such was always present in our dev and testing environments until now)