extensions.rst 26 KB

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