-
Notifications
You must be signed in to change notification settings - Fork 392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JupyterLab Extension to Launch Text Notebooks #1154
Merged
Merged
Changes from 18 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
738b9fc
feat: Create text notebook from lab interface
mahendrapaipuri a6d2c06
feat: Add jupytext menu
mahendrapaipuri ef6b94c
feat: Update npm dependencies
mahendrapaipuri c46b7b3
feat: Modify contentsManager
mahendrapaipuri f224da1
build: Add a custom script to develop extension
mahendrapaipuri 8a194a4
test: Add basic integration tests
mahendrapaipuri 4d95e4c
test: Add reference screenshots for UI tests
mahendrapaipuri 500f76f
style: Fix Lint errors
mahendrapaipuri ebf7a8b
test: Use a pixel tolerance on screenshot comparison
mahendrapaipuri 2370db4
ci: Add integration tests for extension
mahendrapaipuri 4a27ec2
refactor: Revert to original implementation
mahendrapaipuri ccf8939
test: Improve test cases for contents manager
mahendrapaipuri 2593ad0
feat: Make jupytext extension confgurable
mahendrapaipuri 90afb41
docs: Update instructions on extension development
mahendrapaipuri 2cb470d
test: Update integration tests
mahendrapaipuri 36f2595
docs: Add a section about extension in docs
mahendrapaipuri d599980
style: Fix pre-commit issues
mahendrapaipuri 3612e89
test: Remove duplicated snapshots for ui tests
mahendrapaipuri ef304e9
Merge branch 'main' into jlab_frontend_extension
mwouts File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -22,16 +22,30 @@ jupyter labextension install [email protected] # for JupyterLab 1.x | |
|
||
# How to develop this extension | ||
|
||
We assume that you have activated the conda environment described in [CONTRIBUTING.md](https://github.com/mwouts/jupytext/blob/main/CONTRIBUTING.md). | ||
For fine-grained access to the `jlpm` command and various build steps: | ||
|
||
Then you can rebuild the Jupytext python package (with `python -m build`) and reinstall it (`pip install dist/jupytext-x.x.x-py3-none-any.whl`). | ||
```bash | ||
pip install -e '.[dev]' | ||
cd jupyterlab/packages/jupyterlab-jupytext | ||
jlpm | ||
jlpm install:extension # Symlink into `{sys.prefix}/share/jupyter/labextensions` | ||
``` | ||
|
||
Alternatively, if you prefer to develop iteratively, you could install a development version of the extension with | ||
Watch the source directory and automatically rebuild the `lib` folder: | ||
|
||
```bash | ||
jupyter labextension develop . --overwrite | ||
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very helpful! Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
about
jlpm watch
it is indeed very convenient, just keep in mind the.ts
part, because it won't trigger if you only change a.json
though, so in these cases it is important to kill it and restart it, at least that was my experience; I'm unsure about.css
files, so out of safety I am used to relaunchingjlpm watch too
, it may be unnecessary.