Skip to content

Replace deprecated pkg_resources #397

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

Closed
wants to merge 7 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions jupyter_server_proxy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Traitlets based configuration for jupyter_server_proxy
"""
from collections import namedtuple
from importlib.metadata import entry_points
from warnings import warn

import pkg_resources
from jupyter_server.utils import url_path_join as ujoin
from traitlets import Dict, List, Tuple, Union, default, observe
from traitlets.config import Configurable
Expand Down Expand Up @@ -90,7 +90,13 @@ def get_timeout(self):

def get_entrypoint_server_processes(serverproxy_config):
sps = []
for entry_point in pkg_resources.iter_entry_points("jupyter_serverproxy_servers"):
eps = entry_points()
# For versions before importlib_metadata 3.6 and Python 3.10
if hasattr(eps, "select"):
eps = eps.select(group="jupyter_serverproxy_servers")
else:
eps = eps.get("jupyter_serverproxy_servers", [])
for entry_point in eps:
name = entry_point.name
server_process_config = entry_point.load()()
sps.append(make_server_process(name, server_process_config, serverproxy_config))
Expand Down