dropbox-sdk-python
dropbox-sdk-python copied to clipboard
Add Python 3.12 support
Describe the bug This package cannot be used on Python 3.12. Traceback:
from dropbox.files import FileMetadata
.tox/py3.12-django5.0/lib/python3.12/site-packages/dropbox/__init__.py:3: in <module>
from dropbox.dropbox_client import ( # noqa: F[40](https://github.com/jschneier/django-storages/actions/runs/6684029520/job/18170161117#step:5:41)1 # pylint: disable=unused-import
.tox/py3.12-django5.0/lib/python3.12/site-packages/dropbox/dropbox_client.py:[43](https://github.com/jschneier/django-storages/actions/runs/6684029520/job/18170161117#step:5:44): in <module>
from dropbox.session import (
.tox/py3.12-django5.0/lib/python3.12/site-packages/dropbox/session.py:1: in <module>
import pkg_resources
E ModuleNotFoundError: No module named 'pkg_resources'
This appears to be caused by the following deprecation:
- gh-95299: Do not pre-install setuptools in virtual environments created with venv. This means that distutils, setuptools, pkg_resources, and easy_install will no longer available by default; to access these run pip install setuptools in the activated virtual environment.
Ref: Python 3.12 release notes: https://docs.python.org/3/whatsnew/3.12.html
I hope that's enough context 👍
Thanks for the report! I'll ask the team to fix that up.
Bump for this issue. Just add setuptools to install_requires
on this line:
https://github.com/dropbox/dropbox-sdk-python/blob/487793dff3c5a8a3a76010799dc4803cabdb70f3/setup.py#L27C4-L27C4
Or alternatively use the importlib.resources
module if the pkg_resources
module does not exist. pkg_resources
is deprecated in newer versions of Python.
If it will makes things faster, I can provide a PR that fixes this issue. Just LMK
@rianhunter Thanks! We welcome PRs, but I can't promise a timeline for when the team would be able to review/test/release it.
v12.0.0 no longer packages a resource file, so it no longer needs pkg_resources
at runtime. Can you give that a try?
Tried it with Python trunk:
$ env/bin/python
Python 3.14.0a0 (heads/main:fbe6a0988f, May 14 2024, 15:17:09) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dropbox
>>> dropbox.__version__
'12.0.0'
>>>
Imports just fine now. Feel free to close.