@@ -76,7 +76,7 @@ def _default_path_info(self):
7676 )
7777
7878
79- class ServerProcess (Configurable ):
79+ class _ServerProcess (Configurable ):
8080 name = Unicode (help = "Name of the server" ).tag (config = True )
8181
8282 command = List (
@@ -264,6 +264,22 @@ def cats_only(response, path):
264264 ).tag (config = True )
265265
266266
267+ class ServerProcess (_ServerProcess ):
268+ """
269+ A configurable server process for single standalone servers.
270+ This is separate from ServerProcessEntryPoint so that we can configure it
271+ independently of ServerProcessEntryPoint
272+ """
273+
274+
275+ class ServerProcessEntryPoint (_ServerProcess ):
276+ """
277+ A ServeProcess entrypoint that is a Configurable.
278+ This is separate from ServerProcess so that we can configure it
279+ independently of ServerProcess
280+ """
281+
282+
267283def _make_proxy_handler (sp : ServerProcess ):
268284 """
269285 Create an appropriate handler with given parameters
@@ -319,16 +335,23 @@ def get_timeout(self):
319335 return _Proxy
320336
321337
322- def get_entrypoint_server_processes (serverproxy_config ):
338+ def get_entrypoint_server_processes (serverproxy_config , parent ):
323339 sps = []
324340 for entry_point in entry_points (group = "jupyter_serverproxy_servers" ):
325341 name = entry_point .name
326342 try :
327- server_process_config = entry_point .load ()()
343+ server_process_callable = entry_point .load ()
344+ if issubclass (server_process_callable , ServerProcessEntryPoint ):
345+ server_process = server_process_callable (name = name , parent = parent )
346+ sps .append (server_process )
347+ else :
348+ server_process_config = server_process_callable ()
349+ sps .append (
350+ make_server_process (name , server_process_config , serverproxy_config )
351+ )
328352 except Exception as e :
329353 warn (f"entry_point { name } was unable to be loaded: { str (e )} " )
330354 continue
331- sps .append (make_server_process (name , server_process_config , serverproxy_config ))
332355 return sps
333356
334357
0 commit comments