examples.rst 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. Examples
  2. --------
  3. The ``examples`` directory in the JupyterLab repo contains:
  4. - several stand-alone examples (``console``, ``filebrowser``,
  5. ``notebook``, ``terminal``)
  6. - a more complex example (``lab``).
  7. Installation instructions for the examples are found in the project's
  8. README.
  9. After installing the jupyter notebook server 4.2+, follow the steps for
  10. installing the development version of JupyterLab. To build the examples,
  11. enter from the ``jupyterlab`` repo root directory:
  12. ::
  13. jlpm run build:examples
  14. To run a particular example, navigate to the example's subdirectory in
  15. the ``examples`` directory and enter:
  16. ::
  17. python main.py
  18. Dissecting the 'filebrowser' example
  19. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  20. The filebrowser example provides a stand-alone implementation of a
  21. filebrowser. Here's what the filebrowser's user interface looks like:
  22. |filebrowser user interface|
  23. Let's take a closer look at the source code in ``examples/filebrowser``.
  24. Directory structure of 'filebrowser' example
  25. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  26. The filebrowser in ``examples/filebrowser`` is comprised by a handful of
  27. files and the ``src`` directory:
  28. |filebrowser source code|
  29. The filebrowser example has two key source files:
  30. - ``src/index.ts``: the TypeScript file that defines the functionality
  31. - ``main.py``: the Python file that enables the example to be run
  32. Reviewing the source code of each file will help you see the role that
  33. each file plays in the stand-alone filebrowser example.
  34. .. |filebrowser user interface| image:: filebrowser_example.png
  35. .. |filebrowser source code| image:: filebrowser_source.png