Skip to content

pkg_resources is deprecated, soon to be removedΒ #484

@DArtagan

Description

@DArtagan

While launching our application, we've begun to see the following message in the terminal at start-up:

venv/lib/python3.13/site-packages/sassutils/wsgi.py:9: 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

For context, the lines 107-111 from libsass-python/sassutils/wsgi.py look like:

        for package_name in self.manifests:
            if package_name in self.package_dir:
                continue
            path = resource_filename(package_name, '')
            self.package_dir[package_name] = path

An approach

The recommended migration path is to move from pkg_resources to importlib.resources: https://importlib-resources.readthedocs.io/en/latest/migration.html#pkg-resources-resource-filename

Referring to the compatibility chart on https://pypi.org/project/importlib-resources/ for a sense of whether use of the backports library is necessary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions