Skip to content

pkg_resources is deprecated #108

@standage

Description

@standage

Getting this message when using xphyle in a Python 3.11 environment.

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.

The following works on newer Python versions.

from importlib.metadata import version
__version__ = version("xphyle")

I haven't tested it yet, but you should be able to support both newer and older versions with something like this.

try:
    from importlib.metadata import version
    __version__ = version(__name__)
except:
    import pkg_resources
    __version__ = pkg_resources.get_distribution(__name__).version

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions