Skip to content

Replace setuptools/pkg_resources with importlib(.|_)metadata #384

Closed
@bollwyvl

Description

@bollwyvl

Warnings about pkg_resources are getting increasingly loud downstream (e.g. in tests). It's likely time to consider moving to the stdlib importlib.resources, or the backport on not-broken-by-default systems, and removing the setuptools runtime dependency.

Proposed changes:

# pyproject.toml
dependencies = [
  # - "setuptools>=39.0.0",
  "importlib_metadata>=4.8.3;python_version<\"3.10\"",
  # ...
]
# pylsp/config/config.py

# ...

# See compatibility note on `group` keyword in https://docs.python.org/3/library/importlib.metadata.html#entry-points
if sys.version_info < (3, 10):  # pragma: no cover
    from importlib_metadata import entry_points
else:  # pragma: no cover
    from importlib.metadata import entry_points

# ...
    # - for entry_point in pkg_resources.iter_entry_points(PYLSP):
    for entry_point in entry_points(group=PYLSP):

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions