-
Notifications
You must be signed in to change notification settings - Fork 288
Description
When importing or using sweetviz, a deprecation warning is displayed regarding the use of pkg_resources:
C:\Users\Admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\sweetviz\graph.py:8: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
from pkg_resources import resource_filename
Environment
sweetviz version: 2.3.1
Python version: 3.11
Operating System: Windows 11
setuptools version: (likely >=81 based on the warning)
Steps to Reproduce
Install sweetviz 2.3.1: pip install sweetviz
Import sweetviz or any module that uses it
The deprecation warning appears
Root Cause
The file sweetviz/graph.py line 8 uses:
from pkg_resources import resource_filename
This should be replaced with the modern importlib.resources API as recommended by the setuptools documentation.
Suggested Fix
Replace the deprecated pkg_resources usage with importlib.resources. For Python 3.9+:
Instead of:
from pkg_resources import resource_filename
Use:
from importlib import resources
or for older Python compatibility:
try:
from importlib import resources
except ImportError:
import importlib_resources as resources
Impact
While this is currently just a warning, pkg_resources is scheduled for removal on 2025-11-30. This will cause sweetviz to break for users with newer setuptools versions after that date.
Additional Context
This deprecation was introduced in setuptools 81, and affects any package still using the legacy pkg_resources API.