Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Python 3.12 support #483

Closed
sarahboyce opened this issue Oct 31, 2023 · 6 comments
Closed

Add Python 3.12 support #483

sarahboyce opened this issue Oct 31, 2023 · 6 comments
Labels

Comments

@sarahboyce
Copy link

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 👍

@greg-db
Copy link
Contributor

greg-db commented Oct 31, 2023

Thanks for the report! I'll ask the team to fix that up.

@rianhunter
Copy link
Contributor

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.

@rianhunter
Copy link
Contributor

If it will makes things faster, I can provide a PR that fixes this issue. Just LMK

@greg-db
Copy link
Contributor

greg-db commented Jan 8, 2024

@rianhunter Thanks! We welcome PRs, but I can't promise a timeline for when the team would be able to review/test/release it.

@maxbelanger
Copy link
Contributor

v12.0.0 no longer packages a resource file, so it no longer needs pkg_resources at runtime. Can you give that a try?

@rianhunter
Copy link
Contributor

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.

@greg-db greg-db closed this as completed May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants