extensions.rst 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748
  1. .. _user_extensions:
  2. Extensions
  3. ----------
  4. Fundamentally, JupyterLab is designed as an extensible environment. JupyterLab
  5. extensions can customize or enhance any part of JupyterLab. They can provide
  6. new themes, file viewers and editors, or renderers for rich outputs in
  7. notebooks. Extensions can add items to the menu or command palette, keyboard
  8. shortcuts, or settings in the settings system. Extensions can provide an API
  9. for other extensions to use and can depend on other extensions. In fact, the
  10. whole of JupyterLab itself is simply a collection of extensions that are no
  11. more powerful or privileged than any custom extension.
  12. We encourage extension authors to add the `jupyterlab-extension GitHub topic
  13. <https://github.com/search?utf8=%E2%9C%93&q=topic%3Ajupyterlab-extension&type=Repositories>`__
  14. to any GitHub extension repository.
  15. For information about developing extensions, see the :ref:`developer
  16. documentation <developer_extensions>`.
  17. .. contents:: Table of contents
  18. :local:
  19. :depth: 1
  20. Installing Extensions
  21. ~~~~~~~~~~~~~~~~~~~~~
  22. A JupyterLab extension is a JavaScript package that runs in the browser. An
  23. extension's JavaScript can be distributed as a single JavaScript package
  24. (which requires a rebuild of JupyterLab to activate it), or starting in
  25. JupyterLab 3.0, can be bundled together with its dependencies (which does not
  26. require a rebuild of JupyterLab to activate it). Rebuilding JupyterLab
  27. requires Node.js to be :ref:`installed <installing_nodejs>`.
  28. An extension can be installed using the `pip <https://pypi.org/>`__ or `conda
  29. <https://anaconda.org/>`__ package managers, or using the Jupyter Lab tools to install packages from `npm
  30. <https://www.npmjs.com/search?q=keywords:jupyterlab-extension>`__.
  31. - Python ``pip`` or ``conda`` packages can include extensions as either single
  32. JavaScript packages (requiring Node.js and a JupyterLab rebuild) or bundled
  33. with their dependencies (not requiring Node.js nor a JupyterLab rebuild).
  34. These packages may also include by a server-side component necessary for the
  35. extension to function.
  36. - The Extension Manager in JupyterLab or the ``jupyter labextension install``
  37. command install extension packages from `npm
  38. <https://www.npmjs.com/search?q=keywords:jupyterlab-extension>`__. These
  39. require Node.js and a JupyterLab rebuild to activate. See
  40. :ref:`installing_nodejs` and :ref:`install_command`.
  41. .. _installing_nodejs:
  42. Installing Node.js
  43. ^^^^^^^^^^^^^^^^^^
  44. Some extensions require `Node.js <https://nodejs.org/>`__ to rebuild
  45. JupyterLab and activate the extension. If you use ``conda`` with
  46. ``conda-forge`` packages, you can get Node.js with:
  47. .. code:: bash
  48. conda install -c conda-forge nodejs
  49. If you use ``conda`` with default Anaconda packages (i.e., you don't normally use ``conda-forge``), you should install Node.js from the Anaconda default channel with ``conda install nodejs`` instead.
  50. You may also be able to get Node.js from your system package manager, or you
  51. can download Node.js from the `Node.js website <https://nodejs.org/>`__
  52. and install it directly.
  53. .. _install_command:
  54. Installing Extensions with ``jupyter labextension``
  55. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  56. You can install extensions distributed as single JavaScript packages via `npm
  57. <https://www.npmjs.com/search?q=keywords:jupyterlab-extension>`__ using the
  58. command:
  59. .. code:: bash
  60. jupyter labextension install my-extension my-other-extension
  61. Use the ``my-extension@version`` syntax to install a specific version of an
  62. extension, for example:
  63. .. code:: bash
  64. jupyter labextension install my-extension@1.2.3
  65. You can also install an extension that is not uploaded to npm, i.e.,
  66. ``my-extension`` can be a local directory containing the extension, a gzipped
  67. tarball, or a URL to a gzipped tarball.
  68. If you are installing/uninstalling several extensions in several stages,
  69. you may want to defer rebuilding the application by including the flag
  70. ``--no-build`` in the install/uninstall step. Once you are ready to
  71. rebuild, you can run the command:
  72. .. code:: bash
  73. jupyter lab build
  74. .. note::
  75. If you are rebuilding JupyterLab on Windows, you may encounter a
  76. ``FileNotFoundError`` due to the default path length on Windows. Node
  77. modules are stored in a deeply nested directory structure, so paths can get
  78. quite long. If you have administrative access and are on Windows 8 or 10,
  79. you can update the registry setting using these instructions:
  80. https://stackoverflow.com/a/37528731.
  81. Managing Extensions
  82. ~~~~~~~~~~~~~~~~~~~
  83. The ``jupyter labextension`` command or the Extension Manager in JupyterLab
  84. enable you to list installed extensions, disable extensions without
  85. uninstalling them, and install or uninstall extensions distributed as npm
  86. packages. See the help with ``jupyter labextension --help``.
  87. .. note::
  88. The Extension Manager and ``jupyter labextension`` identify an extension by
  89. its JavaScript package name, which may be different from the name of the
  90. ``pip`` or ``conda`` package used to distribute the extension.
  91. Listing installed extensions
  92. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  93. List installed extensions from the command line with
  94. .. code:: bash
  95. jupyter labextension list
  96. or see the list in the Extension Manager in JupyterLab.
  97. Disabling Extensions
  98. ^^^^^^^^^^^^^^^^^^^^
  99. You can disable specific JupyterLab extensions (including core
  100. extensions) without rebuilding the application by running the command:
  101. .. code:: bash
  102. jupyter labextension disable my-extension
  103. This will prevent the extension from activating in the browser.
  104. You can enable an extension using the command:
  105. .. code:: bash
  106. jupyter labextension enable my-extension
  107. Using the Extension Manager
  108. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  109. To manage your extensions, you can use the extension manager. By default, the
  110. manager is disabled. You can enable it by searching **Extension Manager** in the command palette.
  111. .. figure:: images/extension_manager_enable_manager.png
  112. :align: center
  113. :class: jp-screenshot
  114. **Figure:** Enable extension manager by searching in the command palette
  115. You can also enable it with the following steps:
  116. - Go into advanced settings editor.
  117. - Open the Extension Manager section.
  118. - Add the entry "enabled": true.
  119. - Save the settings.
  120. - If prompted whether you are sure, read the warning, and click "Enable"
  121. if you are still sure.
  122. Once enabled, you should see a new tab appear in the :ref:`left sidebar <left-sidebar>`.
  123. .. figure:: images/extension_manager_default.png
  124. :align: center
  125. :class: jp-screenshotls
  126. **Figure:** The default view has three components: a search bar, an "Installed"
  127. section, and a "Discover" section.
  128. Disclaimer
  129. ^^^^^^^^^^
  130. .. danger::
  131. Installing an extension allows it to execute arbitrary code on the
  132. server, kernel, and in the client's browser. Therefore we ask you
  133. to explicitly acknowledge this.
  134. By default, the disclaimer is not acknowledged.
  135. .. figure:: images/listings/disclaimer_unchecked.png
  136. :align: center
  137. :class: jp-screenshot
  138. **Figure:** User has not acknowledged the disclaimer
  139. As the disclaimer is not acknowledged, you can search for an extension,
  140. but can not install it (no install button is available).
  141. .. figure:: images/listings/disclaimer_unchecked_noinstall.png
  142. :align: center
  143. :class: jp-screenshot
  144. **Figure:** With Disclaimer unchecked, you can not install an extension
  145. To install an extension, you first have to explicitly acknowledge the disclaimer.
  146. Once done, this will remain across sessions and the user does not have to
  147. check it again.
  148. .. figure:: images/listings/disclaimer_checked.png
  149. :align: center
  150. :class: jp-screenshot
  151. **Figure:** Disclaimer checked
  152. For ease of use, you can hide the disclaimer so it takes less space on
  153. your screen.
  154. .. figure:: images/listings/disclaimer_hidden.png
  155. :align: center
  156. :class: jp-screenshot
  157. **Figure:** Disclaimer is hidden
  158. Finding Extensions
  159. ^^^^^^^^^^^^^^^^^^
  160. You can use the extension manager to find extensions for JupyterLab. To discovery
  161. freely among the currently available extensions, expand the "Discovery" section.
  162. This triggers a search for all JupyterLab extensions on the NPM registry, and
  163. the results are listed according to the `registry's sort order
  164. <https://docs.npmjs.com/searching-for-and-choosing-packages-to-download#package-search-rank-criteria>`__.
  165. An exception to this sort order is that extensions released by the Jupyter
  166. organization are always placed first. These extensions are distinguished by
  167. a small Jupyter icon next to their name.
  168. .. image:: images/extension_manager_discover.png
  169. :align: center
  170. :class: jp-screenshot
  171. :alt: Screenshot showing the discovery extension listing.
  172. Alternatively, you can limit your discovery by using the search bar. This
  173. performs a free-text search of JupyterLab extensions on the NPM registry.
  174. .. image:: images/extension_manager_search.png
  175. :align: center
  176. :class: jp-screenshot
  177. :alt: Screenshot showing an example search result
  178. Installing an Extension
  179. ^^^^^^^^^^^^^^^^^^^^^^^
  180. Once you have found an extension that you think is interesting, install
  181. it by clicking the "Install" button of the extension list entry.
  182. .. danger::
  183. Installing an extension allows it to execute arbitrary code on the
  184. server, kernel, and in the client's browser. You should therefore
  185. avoid installing extensions you do not trust, and watch out for
  186. any extensions trying to masquerade as a trusted extension.
  187. A short while after starting the install of an extension, a drop-down should
  188. appear under the search bar indicating that the extension has been
  189. downloaded, but that a rebuild is needed to complete the installation.
  190. .. image:: images/extension_manager_rebuild.png
  191. :align: center
  192. :class: jp-screenshot
  193. :alt: Screenshot showing the rebuild indicator
  194. If you want to install/uninstall other extensions as well, you can ignore
  195. the rebuild notice until you have made all the changes you want. Once satisfied,
  196. click the 'Rebuild' button to start a rebuild in the background.
  197. Once the rebuild completes, a dialog will pop up, indicating that a reload of
  198. the page is needed in order to load the latest build into the browser.
  199. If you ignore the rebuild notice by mistake, simply refresh your browser
  200. window to trigger a new rebuild check.
  201. Managing Installed Extensions
  202. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  203. When there are some installed extensions, they will be shown in the "Installed"
  204. section. These can then be uninstalled or disabled. Disabling an extension will
  205. prevent it from being activated, but without rebuilding the application.
  206. Companion packages
  207. ^^^^^^^^^^^^^^^^^^
  208. During installation of an extension, JupyterLab will inspect the package
  209. metadata for any
  210. :ref:`instructions on companion packages <ext-author-companion-packages>`.
  211. Companion packages can be:
  212. - Notebook server extensions (or any other packages that need to be
  213. installed on the Notebook server).
  214. - Kernel packages. An example of companion packages for the
  215. kernel are Jupyter Widget packages, like the `ipywidgets <https://ipywidgets.readthedocs.io/en/stable>`__
  216. Python package for the
  217. `@jupyter-widgets/jupyterlab-manager package <https://www.npmjs.com/package/@jupyter-widgets/jupyterlab-manager>`__.
  218. If JupyterLab finds instructions for companion packages, it will present
  219. a dialog to notify you about these. These are informational only, and it
  220. will be up to you to take these into account or not.
  221. .. _extension_listings:
  222. Listings
  223. ~~~~~~~~
  224. When searching extensions, JupyterLab displays the complete search result and
  225. the user is free to install any extension. This is the :ref:`default_mode`.
  226. To bring more security, you or your administrator can enable ``blocklists`` or ``allowlists``
  227. mode. JupyterLab will check the extensions against the defined listings.
  228. .. warning::
  229. Only one mode at a time is allowed. If you or your server administrator configures
  230. both block and allow listings, the JupyterLab server will not start.
  231. .. figure:: images/listings/simultaneous_block_allow_listings.png
  232. :align: center
  233. :class: jp-screenshot
  234. **Figure:** Simultaneous block and allow listings
  235. The following details the behavior for the :ref:`blocklist_mode` and the :ref:`allowlist_mode`.
  236. The details to enable configure the listings can be read :ref:`listings_conf`.
  237. .. _default_mode:
  238. Default mode
  239. ^^^^^^^^^^^^
  240. In the ``default`` mode, no listing is enabled and the search behavior is unchanged and
  241. is the one described previously.
  242. .. _blocklist_mode:
  243. Blocklist mode
  244. ^^^^^^^^^^^^^^
  245. Extensions can be freely downloaded without going through a vetting process.
  246. However, users can add malicious extensions to a blocklist. The extension manager
  247. will show all extensions except for those that have
  248. been explicitly added to the blocklist. Therfore, the extension manager
  249. does not allow you to install blocklisted extensions.
  250. If you, or your administrator, has enabled the blocklist mode,
  251. JupyterLab will use the blocklist and remove all blocklisted
  252. extensions from your search result.
  253. If you have installed an extension before it has been blocklisted,
  254. the extension entry in the installed list will be highlighted
  255. in red. It is recommended that you uninstall it. You can move
  256. your mouse on the question mark icon to read the instructions.
  257. .. figure:: images/listings/installed_blocklisted.png
  258. :align: center
  259. :class: jp-screenshot
  260. **Figure:** Blocklisted installed extension which should be removed
  261. .. _allowlist_mode:
  262. Allowlist mode
  263. ^^^^^^^^^^^^^^
  264. An allowlist maintains a set of approved extensions that users can freely
  265. search and install. Extensions need to go through some sort of vetting process
  266. before they are added to the allowlist. When using an allowlist, the extension manager
  267. will only show extensions that have been explicitly added to the allowlist.
  268. If you, or your administrator, has enabled the allowlist mode
  269. JupyterLab will use the allowlist and only show extensions present
  270. in the withelist. The other extensions will not be show in the search result.
  271. If you have installed an allowlisted extension and at some point
  272. in time that extension is removed from the allowlist, the extension entry
  273. in the installed list will be highlighted in red. It is recommended that
  274. you uninstall it. You can move your mouse on the question mark icon to
  275. read the instructions.
  276. .. figure:: images/listings/installed_allowlisted.png
  277. :align: center
  278. :class: jp-screenshot
  279. **Figure:** The second of the installed extensions was removed from the allowlist and should be removed
  280. .. _listings_conf:
  281. Listing Configuration
  282. ^^^^^^^^^^^^^^^^^^^^^
  283. You or your administrator can use the following traits to define the listings loading.
  284. - ``blocklist_uris``: A list of comma-separated URIs to fetch a blocklist file from
  285. - ``allowlist_uris``: A list of comma-separated URIs to fetch an allowlist file from
  286. - ``listings_refresh_seconds``: The interval delay in seconds to refresh the lists
  287. - ``listings_request_options``: The optional kwargs to use for the listings HTTP requests
  288. For example, to enable blocklist, launch the server with ``--LabServerApp.blocklist_uris=http://example.com/blocklist.json`` where ``http://example.com/blocklist.json`` is a blocklist JSON file as described below.
  289. The details for the listings_request_options are listed
  290. on `this page <https://2.python-requests.org/en/v2.7.0/api/#requests.request>`__
  291. (for example, you could pass ``{'timeout': 10}`` to change the HTTP request timeout value).
  292. The listings are json files hosted on the URIs you have given.
  293. For each entry, you have to define the `name` of the extension as published in the NPM registry.
  294. The ``name`` attribute supports regular expressions.
  295. Optionally, you can also add some more fields for your records (``type``, ``reason``, ``creation_date``,
  296. ``last_update_date``). These optional fields are not used in the user interface.
  297. This is an example of a blocklist file.
  298. .. code:: json
  299. {
  300. "blocklist": [
  301. {
  302. "name": "@jupyterlab-examples/launcher",
  303. "type": "jupyterlab",
  304. "reason": "@jupyterlab-examples/launcher is blocklisted for test purpose - Do NOT take this for granted!!!",
  305. "creation_date": "2020-03-11T03:28:56.782Z",
  306. "last_update_date": "2020-03-11T03:28:56.782Z"
  307. }
  308. ]
  309. }
  310. In the following allowlist example a ``@jupyterlab/*`` will allowlist
  311. all jupyterlab organization extensions.
  312. .. code:: json
  313. {
  314. "allowlist": [
  315. {
  316. "name": "@jupyterlab/*",
  317. "type": "jupyterlab",
  318. "reason": "All @jupyterlab org extensions are allowlisted, of course...",
  319. "creation_date": "2020-03-11T03:28:56.782Z",
  320. "last_update_date": "2020-03-11T03:28:56.782Z"
  321. }
  322. ]
  323. }
  324. Advanced Usage
  325. ~~~~~~~~~~~~~~
  326. Any information that JupyterLab persists is stored in its application directory,
  327. including settings and built assets.
  328. This is separate from where the Python package is installed (like in ``site_packages``)
  329. so that the install directory is immutable.
  330. The application directory can be overridden using ``--app-dir`` in
  331. any of the JupyterLab commands, or by setting the ``JUPYTERLAB_DIR``
  332. environment variable. If not specified, it will default to
  333. ``<sys-prefix>/share/jupyter/lab``, where ``<sys-prefix>`` is the
  334. site-specific directory prefix of the current Python environment. You
  335. can query the current application path by running ``jupyter lab path``.
  336. Note that the application directory is expected to contain the JupyterLab
  337. static assets (e.g. `static/index.html`). If JupyterLab is launched
  338. and the static assets are not present, it will display an error in the console and in the browser.
  339. JupyterLab Build Process
  340. ^^^^^^^^^^^^^^^^^^^^^^^^
  341. To rebuild the app directory, run ``jupyter lab build``. By default, the
  342. ``jupyter labextension install`` command builds the application, so you
  343. typically do not need to call ``build`` directly.
  344. Building consists of:
  345. - Populating the ``staging/`` directory using template files
  346. - Handling any locally installed packages
  347. - Ensuring all installed assets are available
  348. - Bundling the assets
  349. - Copying the bundled assets to the ``static`` directory
  350. Note that building will always use the latest JavaScript packages that meet
  351. the dependency requirements of JupyterLab itself and any installed extensions.
  352. If you wish to run JupyterLab with the set of pinned requirements that was
  353. shipped with the Python package, you can launch as
  354. ``jupyter lab --core-mode``.
  355. **Note**
  356. The build process uses a specific ``yarn`` version with a default working
  357. combination of npm packages stored in a ``yarn.lock`` file shipped with
  358. JupyterLab. Those package source urls point to the default yarn registry.
  359. But if you defined your own yarn registry in yarn configuration, the
  360. default yarn registry will be replaced by your custom registry.
  361. If then you switch back to the default yarn registry, you will need to
  362. clean your ``staging`` folder before building:
  363. .. code:: bash
  364. jupyter lab clean
  365. jupyter lab build
  366. JupyterLab Application Directory
  367. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  368. The JupyterLab application directory contains the subdirectories
  369. ``extensions``, ``schemas``, ``settings``, ``staging``, ``static``, and
  370. ``themes``. The default application directory mirrors the location where
  371. JupyterLab was installed. For example, in a conda environment, it is in
  372. ``<conda_root>/envs/<env_name>/share/jupyter/lab``. The directory can be
  373. overridden by setting a ``JUPYTERLAB_DIR`` environment variable.
  374. It is not recommended to install JupyterLab in a root location (on Unix-like
  375. systems). Instead, use a conda environment or ``pip install --user jupyterlab``
  376. so that the application directory ends up in a writable location.
  377. Note: this folder location and semantics do *not* follow the standard Jupyter
  378. config semantics because we need to build a single unified application, and the
  379. default config location for Jupyter is at the user level (user's home directory).
  380. By explicitly using a directory alongside the currently installed JupyterLab,
  381. we can ensure better isolation between conda or other virtual environments.
  382. .. _extensions-1:
  383. extensions
  384. ''''''''''
  385. The ``extensions`` directory has the packed tarballs for each of the
  386. installed extensions for the app. If the application directory is not
  387. the same as the ``sys-prefix`` directory, the extensions installed in
  388. the ``sys-prefix`` directory will be used in the app directory. If an
  389. extension is installed in the app directory that exists in the
  390. ``sys-prefix`` directory, it will shadow the ``sys-prefix`` version.
  391. Uninstalling an extension will first uninstall the shadowed extension,
  392. and then attempt to uninstall the ``sys-prefix`` version if called
  393. again. If the ``sys-prefix`` version cannot be uninstalled, its plugins
  394. can still be ignored using ``ignoredPackages`` metadata in ``settings``.
  395. schemas
  396. '''''''
  397. The ``schemas`` directory contains `JSON
  398. Schemas <http://json-schema.org/>`__ that describe the settings used by
  399. individual extensions. Users may edit these settings using the
  400. JupyterLab Settings Editor.
  401. settings
  402. ''''''''
  403. The ``settings`` directory may contain ``page_config.json``, ``overrides.json``, and/or
  404. ``build_config.json`` files, depending on which configurations are
  405. set on your system.
  406. .. _page_configjson:
  407. page_config.json
  408. The ``page_config.json`` data is used to provide configuration data to the
  409. application environment.
  410. The following configurations may be present in this file:
  411. 1. ``terminalsAvailable`` identifies whether a terminal (i.e. ``bash/tsch``
  412. on Mac/Linux OR ``PowerShell`` on Windows) is available to be launched
  413. via the Launcher. (This configuration was predominantly required for
  414. Windows prior to PowerShell access being enabled in Jupyter Lab.) The
  415. value for this field is a Boolean: ``true`` or ``false``.
  416. 2. ``disabledExtensions`` controls which extensions should not load at all.
  417. 3. ``deferredExtensions`` controls which extensions should not load until
  418. they are required by something, irrespective of whether they set
  419. ``autoStart`` to ``true``.
  420. The value for the ``disabledExtensions`` and ``deferredExtensions`` fields
  421. are an array of strings. The following sequence of checks are performed
  422. against the patterns in ``disabledExtensions`` and ``deferredExtensions``.
  423. - If an identical string match occurs between a config value and a
  424. package name (e.g., ``"@jupyterlab/apputils-extension"``), then the
  425. entire package is disabled (or deferred).
  426. - If the string value is compiled as a regular expression and tests
  427. positive against a package name (e.g.,
  428. ``"disabledExtensions": ["@jupyterlab/apputils*$"]``), then the
  429. entire package is disabled (or deferred).
  430. - If an identical string match occurs between a config value and an
  431. individual plugin ID within a package (e.g.,
  432. ``"disabledExtensions": ["@jupyterlab/apputils-extension:settings"]``),
  433. then that specific plugin is disabled (or deferred).
  434. - If the string value is compiled as a regular expression and tests
  435. positive against an individual plugin ID within a package (e.g.,
  436. ``"disabledExtensions": ["^@jupyterlab/apputils-extension:set.*$"]``),
  437. then that specific plugin is disabled (or deferred).
  438. An example of a ``page_config.json`` file is:
  439. .. code:: json
  440. {
  441. "disabledExtensions": [
  442. "@jupyterlab/toc"
  443. ],
  444. "terminalsAvailable": false
  445. }
  446. .. _overridesjson:
  447. overrides.json
  448. You can override default values of the extension settings by
  449. defining new default values in an ``overrides.json`` file.
  450. So for example, if you would like
  451. to set the dark theme by default instead of the light one, an
  452. ``overrides.json`` file containing the following lines needs to be
  453. added in the application settings directory (by default this is the
  454. ``share/jupyter/lab/settings`` folder).
  455. .. code:: json
  456. {
  457. "@jupyterlab/apputils-extension:themes": {
  458. "theme": "JupyterLab Dark"
  459. }
  460. }
  461. .. _build_configjson:
  462. build_config.json
  463. The ``build_config.json`` file is used to track the local directories
  464. that have been installed using
  465. ``jupyter labextension install <directory>``, as well as core extensions
  466. that have been explicitly uninstalled. An example of a
  467. ``build_config.json`` file is:
  468. .. code:: json
  469. {
  470. "uninstalled_core_extensions": [
  471. "@jupyterlab/markdownwidget-extension"
  472. ],
  473. "local_extensions": {
  474. "@jupyterlab/python-tests": "/path/to/my/extension"
  475. }
  476. }
  477. staging and static
  478. ''''''''''''''''''
  479. The ``static`` directory contains the assets that will be loaded by the
  480. JupyterLab application. The ``staging`` directory is used to create the
  481. build and then populate the ``static`` directory.
  482. Running ``jupyter lab`` will attempt to run the ``static`` assets in the
  483. application directory if they exist. You can run
  484. ``jupyter lab --core-mode`` to load the core JupyterLab application
  485. (i.e., the application without any extensions) instead.
  486. themes
  487. ''''''
  488. The ``themes`` directory contains assets (such as CSS and icons) for
  489. JupyterLab theme extensions.
  490. JupyterLab User Settings Directory
  491. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  492. The user settings directory contains the user-level settings for Jupyter extensions.
  493. By default, the location is ``~/.jupyter/lab/user-settings/``, where ``~`` is the user's home directory. This folder is not in the JupyterLab application directory,
  494. because these settings are typically shared across Python environments.
  495. The location can be modified using the ``JUPYTERLAB_SETTINGS_DIR`` environment variable. Files are automatically created in this folder as modifications are made
  496. to settings from the JupyterLab UI. They can also be manually created. The files
  497. follow the pattern of ``<package_name>/<extension_name>.jupyterlab-settings``.
  498. They are JSON files with optional comments. These values take precedence over the
  499. default values given by the extensions, but can be overridden by an ``overrides.json``
  500. file in the application's settings directory.
  501. JupyterLab Workspaces Directory
  502. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  503. JupyterLab sessions always reside in a workspace. Workspaces contain the state
  504. of JupyterLab: the files that are currently open, the layout of the application
  505. areas and tabs, etc. When the page is refreshed, the workspace is restored.
  506. By default, the location is ``~/.jupyter/lab/workspaces/``, where ``~`` is the user's home directory. This folder is not in the JupyterLab application directory,
  507. because these files are typically shared across Python environments.
  508. The location can be modified using the ``JUPYTERLAB_WORKSPACES_DIR`` environment variable. These files can be imported and exported to create default "profiles",
  509. using the :ref:`workspace command line tool <url-workspaces-cli>`.
  510. Disabling Rebuild Checks
  511. ~~~~~~~~~~~~~~~~~~~~~~~~
  512. JupyterLab automatically checks to see if it needs to rebuild on startup. In
  513. some cases, such as automated testing, you may wish to disable the startup
  514. rebuild checks altogether. This can be achieved through setting ``buildCheck``
  515. and ``buildAvailable`` in ``jupyter_notebook_config.json`` (or ``.py``
  516. equivalent) in any of the ``config`` locations returned by ``jupyter
  517. --paths``.
  518. .. code:: json
  519. {
  520. "LabApp": {
  521. "tornado_settings": {
  522. "page_config_data": {
  523. "buildCheck": false,
  524. "buildAvailable": false,
  525. }
  526. }
  527. }
  528. }