@@ -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
#
@@ -1749,17 +1751,18 @@ def _init_asyncio_patch():
1749
1751
asyncio .set_event_loop_policy (WindowsSelectorEventLoopPolicy ())
1750
1752
1751
1753
@catch_config_error
1752
- def initialize (self , argv = None , load_extensions = True , new_httpserver = True ):
1754
+ def initialize (self , argv = None , find_extensions = True , new_httpserver = True ):
1753
1755
"""Initialize the Server application class, configurables, web application, and http server.
1754
1756
1755
1757
Parameters
1756
1758
----------
1757
1759
argv: list or None
1758
1760
CLI arguments to parse.
1759
1761
1760
- load_extensions: bool
1761
- If True, the server will load server extensions listed in the jpserver_extension trait.
1762
- Otherwise, no server extensions will be loaded.
1762
+ find_extensions: bool
1763
+ If True, find and load extensions listed in Jupyter config paths. If False,
1764
+ only load extensions that are passed to ServerApp directy through
1765
+ the `argv`, `config`, or `jpserver_extensions` arguments.
1763
1766
1764
1767
new_httpserver: bool
1765
1768
If True, a tornado HTTPServer instance will be created and configured for the Server Web
@@ -1769,11 +1772,11 @@ def initialize(self, argv=None, load_extensions=True, new_httpserver=True):
1769
1772
# Parse command line, load ServerApp config files,
1770
1773
# and update ServerApp config.
1771
1774
super (ServerApp , self ).initialize (argv )
1772
-
1773
1775
# Then, use extensions' config loading mechanism to
1774
1776
# update config. ServerApp config takes precedence.
1775
- if load_extensions :
1776
- self .init_server_extensions ()
1777
+ if find_extensions :
1778
+ self .find_server_extensions ()
1779
+ self .init_server_extensions ()
1777
1780
# Initialize all components of the ServerApp.
1778
1781
self .init_logging ()
1779
1782
if self ._dispatching :
@@ -1785,8 +1788,7 @@ def initialize(self, argv=None, load_extensions=True, new_httpserver=True):
1785
1788
self .init_httpserver ()
1786
1789
self .init_terminals ()
1787
1790
self .init_signal ()
1788
- if load_extensions :
1789
- self .load_server_extensions ()
1791
+ self .load_server_extensions ()
1790
1792
self .init_mime_overrides ()
1791
1793
self .init_shutdown_no_activity ()
1792
1794
0 commit comments