-
Notifications
You must be signed in to change notification settings - Fork 392
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1154 from mahendrapaipuri/jlab_frontend_extension
* feat: Create text notebook from lab interface - Users should be able to create text notebooks in different formats - Launcher icons have been added to create text notebooks - Existing extension code has been refactored to split into logical files * feat: Add jupytext menu - A dedicated Jupytext menu has been added to launch text notebooks * feat: Update npm dependencies - Add dependencies needed for launching text notebooks * feat: Modify contentsManager - Check properly if asked model is of jupytext or native format - Add few tests to ensure that jupytext contentsManager is creating files properly * build: Add a custom script to develop extension - Repo organization does not permit to use native jupyterlab script - Small utility script has been added to create symlink of extension data while in dev mode * test: Add basic integration tests - Galata UI tests have been added to check jupytext extension * test: Add reference screenshots for UI tests * style: Fix Lint errors * test: Use a pixel tolerance on screenshot comparison - Comparing colors can be a bit flaky given colors can vary across platforms - We use a maxDiffPixelRatio to smooth these issues out of tests * ci: Add integration tests for extension * refactor: Revert to original implementation * test: Improve test cases for contents manager * feat: Make jupytext extension confgurable - Users will be able to configure category of Text notebooks in launcher - Users can configure which formats should be added to launcher - These configs will be available via Settings in JupyterLab * docs: Update instructions on extension development * test: Update integration tests * docs: Add a section about extension in docs * style: Fix pre-commit issues * test: Remove duplicated snapshots for ui tests
- Loading branch information
Showing
43 changed files
with
3,547 additions
and
1,025 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: test-ui | ||
run-name: Run UI tests with Galata | ||
|
||
on: | ||
workflow_call: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }}-ui-test | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
test-ui: | ||
continue-on-error: false | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Base Setup | ||
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 | ||
|
||
- name: Install from source (required for the pre-commit tests) | ||
run: python -m pip install -e '.[test-cov]' | ||
|
||
- name: Install galata | ||
working-directory: jupyterlab/packages/jupyterlab-jupytext-extension/ui-tests | ||
env: | ||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 | ||
run: jlpm install | ||
|
||
- name: Install browser | ||
working-directory: jupyterlab/packages/jupyterlab-jupytext-extension/ui-tests | ||
run: jlpm playwright install chromium | ||
|
||
- name: Integration tests | ||
working-directory: jupyterlab/packages/jupyterlab-jupytext-extension/ui-tests | ||
run: jlpm playwright test | ||
|
||
- name: Upload UI Test artifacts | ||
if: failure() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ui-test-output | ||
path: | | ||
jupyterlab/packages/jupyterlab-jupytext-extension/ui-tests/test-results |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Frontend extension | ||
|
||
Recent versions of Jupytext (`>=1.16.0`) ships frontend extension that enables users | ||
to create text notebooks and pair notebooks from main menu of JupyterLab 4 and | ||
Notebook 7. In addition, the frontend extension adds selected Jupytext text | ||
notebook formats to launcher in the `Jupytext` section so that users can launch text | ||
notebooks as they launch a regular notebook from JupyterLab launcher. | ||
|
||
## Launcher icons | ||
|
||
After installing Jupytext extension, users will have a new category in the launcher | ||
called Jupytext as shown below: | ||
|
||
![](images/jupyterlab_launcher.png) | ||
|
||
Users can remove and/or add new formats to the Jupytext section _via_ `Settings>Jupytext`. | ||
|
||
![](images/jupyterlab_settings.png) | ||
|
||
By clicking `Add` and adding a new format, say `qmd`, will | ||
add the Quatro Text Notebook to the launcher. **Note** that users need to refresh the current browser tab when they modify the settings for them to take effect. | ||
|
||
Besides, users can also change the category of Text Notebook launcher icons using | ||
`Category` field in the Settings. For example, by using `Notebook` as category, all | ||
Text Notebook launchers will be moved into `Notebook` category. | ||
|
||
## Main menu | ||
|
||
It is also possible to launch text notebooks and/or pair existing notebooks from the dedicated Jupytext main menu as shown below. | ||
|
||
![](images/jupyterlab_main_menu.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,15 +23,33 @@ jupyter labextension install [email protected] # for JupyterLab 1.x | |
|
||
# How to develop this extension | ||
|
||
Please follow the instructions at [developing.md](../../../docs/developing.md), i.e. | ||
create a Python environment with a recent version of `nodejs`, and install | ||
a development version of Jupytext by running | ||
For fine-grained access to the `jlpm` command and various build steps: | ||
|
||
```bash | ||
pip install -e '.[dev]' | ||
cd jupyterlab/packages/jupyterlab-jupytext | ||
jlpm | ||
jlpm install:extension # Symlink into `{sys.prefix}/share/jupyter/labextensions` | ||
``` | ||
|
||
at the root of the Jupytext repository. | ||
(see also the instructions at [developing.md](../../../docs/developing.md) on how to create a Python environment with a recent version of `nodejs`) | ||
|
||
Watch the source directory and automatically rebuild the `lib` folder: | ||
|
||
```bash | ||
cd jupyterlab/packages/jupyterlab-jupytext | ||
# Watch the source directory in one terminal, automatically rebuilding when needed | ||
jlpm watch | ||
# Run JupyterLab in another terminal | ||
jupyter lab | ||
``` | ||
|
||
While running `jlpm watch`, every saved change to a `.ts` file will immediately be | ||
built locally and available in your running Jupyter client. "Hard" refresh JupyterLab or Notebook | ||
with <kbd>CTRL-F5</kbd> or <kbd>⌘-F5</kbd> to load the change in your browser | ||
(you may need to wait several seconds for the extension to be fully rebuilt). | ||
|
||
Read more on this on the [JupyterLab documentation](https://jupyterlab.readthedocs.io/en/latest/extension/extension_dev.html#developing-a-prebuilt-extension). | ||
|
||
# How to publish a new version of the extension on npm | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.