extensions.rst 27 KB

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