-
Notifications
You must be signed in to change notification settings - Fork 217
Find entry_points
with importlib(.|_)metadata
, drop setuptools
from dependencies
#385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
https://docs.python.org/3.8/library/importlib.metadata.html#entry-points It seems that |
import pluggy | ||
from pluggy._hooks import HookImpl | ||
|
||
from pylsp import _utils, hookspecs, uris, PYLSP | ||
|
||
# See compatibility note on `group` keyword: | ||
# https://docs.python.org/3/library/importlib.metadata.html#entry-points |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that from
importlib.metadata import entry_points
will work even before 3.10.
Reproduced here from this link, emphasis mine:
The “selectable” entry points were introduced in
importlib_metadata
3.6 and Python 3.10. Prior to those changes,entry_points
accepted no parameters and always returned a dictionary of entry points, keyed by group. For compatibility, if no parameters are passed toentry_points
, aSelectableGroups
object is returned, implementing that dict interface. In the future, callingentry_points
with no parameters will return anEntryPoints
object. Users should rely on the selection interface to retrieve entry points by group.
Before 3.10 stdlib, and older importlib_metadata
, all of the entry_points
in $PREFIX/lib/python-3*
are discovered and parsed without any kind of cache. In a large environment, this can take a number of seconds. The venerable entrypoints
did this a bit better, but is now deprecated, leaving this half-measure until 3.9 EOL to avoid getting bitten by inconsistent return types and performance cliffs.
entry_points
with importlib(.|_)metadata
, drop setuptools
from dependencies
entry_points
with importlib(.|_)metadata
, drop setuptools
from dependencies
It seems this requires dropping support for Python 3.7, so I'm going to leave it for 1.8.0. |
oh, |
…metadata (or backport if needed)
9dfe6b2
to
234a5d9
Compare
re ⚾ d |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @bollwyvl for your help with this!
…from `dependencies` (python-lsp#385)
References
setuptools
/pkg_resources
withimportlib(.|_)metadata
#384Changes
setuptools
(only used forentry_point
discovery)importlib_metdata
on python <3.10importlib.metadata
on python 3.10+pluggy
does the same