extensions.rst 26 KB

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