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

mongomock needs to declare dependency on setuptools (or stop using it) #850

Open
wimglenn opened this issue Jul 6, 2023 · 1 comment
Open

Comments

@wimglenn
Copy link

wimglenn commented Jul 6, 2023

Mongomock uses setuptools unconditionally. However, setuptools (which provides pkg_resources) is not stdlib, and it is not guaranteed to be there. So it needs to be specified as a dependency, otherwise users can get:

$ python3 -c 'import mongomock'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/.../.venv/lib/python3.9/site-packages/mongomock/__init__.py", line 79, in <module>
    from mongomock.__version__ import __version__
  File "/.../.venv/lib/python3.9/site-packages/mongomock/__version__.py", line 1, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

The current depenency tree is missing setuptools:

$ johnnydep mongomock==4.1.2
name              summary
----------------  -----------------------------------------------------------
mongomock==4.1.2  Fake pymongo stub for testing simple MongoDB-dependent code
├── packaging     Core utilities for Python packages
└── sentinels     Various objects to denote special meanings in python

The alternative would be to stop importing pkg_resources, which is deprecated anyway (#848), and use stdlib importlib.metadata to retrieve the installed version instead.

@wimglenn wimglenn changed the title mongomock needs to declare dependency on setuptools mongomock needs to declare dependency on setuptools (or stop using it) Jul 6, 2023
@stur86
Copy link

stur86 commented Sep 27, 2023

I support switching to the newer importlib implementation, the deprecation warning messages are quite annoying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants