Skip to content

Replace deprecated pkg_resources import with importlib #287

@dennisushi

Description

@dennisushi

Describe the issue

sapien/__init__.py unconditionally imports pkg_resources, which triggers a deprecation warning from setuptools>=81:

python3.12/site-packages/sapien/__init__.py:18: 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.

This affects both the 3.0.2 release and the nightly branch.

To Reproduce

import sapien

Expected behavior

No warning.

Suggested fix

Replace import pkg_resources with importlib.metadata / importlib.resources (stdlib since Python 3.9).

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