@@ -1482,18 +1482,12 @@ def init_components(self):
1482
1482
# TODO: this should still check, but now we use bower, not git submodule
1483
1483
pass
1484
1484
1485
- def init_server_extensions (self ):
1485
+ def find_server_extensions (self ):
1486
1486
"""
1487
1487
Searches Jupyter paths for jpserver_extensions and captures
1488
1488
metadata for all enabled extensions.
1489
-
1490
- If an extension's metadata includes an 'app' key,
1491
- the value must be a subclass of ExtensionApp. An instance
1492
- of the class will be created at this step. The config for
1493
- this instance will inherit the ServerApp's config object
1494
- and load its own config.
1495
1489
"""
1496
- # Step 1: Walk through all config files looking for jpserver_extensions.
1490
+ # Walk through all config files looking for jpserver_extensions.
1497
1491
#
1498
1492
# Each extension will likely have a JSON config file enabling itself in
1499
1493
# the "jupyter_server_config.d" directory. Find each of these and
@@ -1521,7 +1515,15 @@ def init_server_extensions(self):
1521
1515
self .config .ServerApp .jpserver_extensions .update ({modulename : enabled })
1522
1516
self .jpserver_extensions .update ({modulename : enabled })
1523
1517
1524
- # Step 2: Load extension metadata for enabled extensions, load config for
1518
+ def init_server_extensions (self ):
1519
+ """
1520
+ If an extension's metadata includes an 'app' key,
1521
+ the value must be a subclass of ExtensionApp. An instance
1522
+ of the class will be created at this step. The config for
1523
+ this instance will inherit the ServerApp's config object
1524
+ and load its own config.
1525
+ """
1526
+ # Load extension metadata for enabled extensions, load config for
1525
1527
# enabled ExtensionApps, and store enabled extension metadata in the
1526
1528
# _enabled_extensions attribute.
1527
1529
#
@@ -1758,17 +1760,18 @@ def _init_asyncio_patch():
1758
1760
asyncio .set_event_loop_policy (WindowsSelectorEventLoopPolicy ())
1759
1761
1760
1762
@catch_config_error
1761
- def initialize (self , argv = None , load_extensions = True , new_httpserver = True ):
1763
+ def initialize (self , argv = None , find_extensions = True , new_httpserver = True ):
1762
1764
"""Initialize the Server application class, configurables, web application, and http server.
1763
1765
1764
1766
Parameters
1765
1767
----------
1766
1768
argv: list or None
1767
1769
CLI arguments to parse.
1768
1770
1769
- load_extensions: bool
1770
- If True, the server will load server extensions listed in the jpserver_extension trait.
1771
- Otherwise, no server extensions will be loaded.
1771
+ find_extensions: bool
1772
+ If True, find and load extensions listed in Jupyter config paths. If False,
1773
+ only load extensions that are passed to ServerApp directy through
1774
+ the `argv`, `config`, or `jpserver_extensions` arguments.
1772
1775
1773
1776
new_httpserver: bool
1774
1777
If True, a tornado HTTPServer instance will be created and configured for the Server Web
@@ -1778,11 +1781,11 @@ def initialize(self, argv=None, load_extensions=True, new_httpserver=True):
1778
1781
# Parse command line, load ServerApp config files,
1779
1782
# and update ServerApp config.
1780
1783
super (ServerApp , self ).initialize (argv )
1781
-
1782
1784
# Then, use extensions' config loading mechanism to
1783
1785
# update config. ServerApp config takes precedence.
1784
- if load_extensions :
1785
- self .init_server_extensions ()
1786
+ if find_extensions :
1787
+ self .find_server_extensions ()
1788
+ self .init_server_extensions ()
1786
1789
# Initialize all components of the ServerApp.
1787
1790
self .init_logging ()
1788
1791
if self ._dispatching :
@@ -1794,8 +1797,7 @@ def initialize(self, argv=None, load_extensions=True, new_httpserver=True):
1794
1797
self .init_httpserver ()
1795
1798
self .init_terminals ()
1796
1799
self .init_signal ()
1797
- if load_extensions :
1798
- self .load_server_extensions ()
1800
+ self .load_server_extensions ()
1799
1801
self .init_mime_overrides ()
1800
1802
self .init_shutdown_no_activity ()
1801
1803
0 commit comments