components.rst 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. Using JupyterLab components
  2. ===========================
  3. JupyterLab is built with many re-usable components that are
  4. independently `published on npm <https://www.npmjs.com/search?q=%40jupyterlab>`_.
  5. JupyterLab itself assembles these components together to provide a full,
  6. IDE-like experience. However, developers are encouraged to use these to bring
  7. to life their own visions of what a computational environment should look
  8. like.
  9. The JupyterLab repository has `many examples <https://github.com/jupyterlab/jupyterlab/tree/3.4.x/examples>`_
  10. to get you started.
  11. The ``examples`` directory contains:
  12. - several stand-alone examples (``console``, ``filebrowser``,
  13. ``notebook``, ``terminal``)
  14. - a more complex example (``lab``).
  15. Installation instructions for the examples are found in the project's
  16. README.
  17. After installing the jupyter notebook server 4.2+, follow the steps for
  18. installing the development version of JupyterLab. To build the examples,
  19. enter from the ``jupyterlab`` repo root directory:
  20. ::
  21. jlpm run build:examples
  22. To run a particular example, navigate to the example's subdirectory in
  23. the ``examples`` directory and enter:
  24. ::
  25. python main.py
  26. Dissecting the 'filebrowser' example
  27. ------------------------------------
  28. The filebrowser example provides a stand-alone implementation of a
  29. filebrowser. Here's what the filebrowser’s user interface looks like:
  30. |filebrowser user interface|
  31. Let's take a closer look at the source code in ``examples/filebrowser``.
  32. Directory structure of 'filebrowser' example
  33. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  34. The filebrowser in ``examples/filebrowser`` is comprised by a handful of
  35. files and the ``src`` directory:
  36. |filebrowser source code|
  37. The filebrowser example has two key source files:
  38. - ``src/index.ts``: the TypeScript file that defines the functionality
  39. - ``main.py``: the Python file that enables the example to be run
  40. Reviewing the source code of each file will help you see the role that
  41. each file plays in the stand-alone filebrowser example.
  42. .. |filebrowser user interface| image:: filebrowser_example.png
  43. .. |filebrowser source code| image:: filebrowser_source.png