Skip to content

Commit

Permalink
Merge branch 'master' into completer-bug
Browse files Browse the repository at this point in the history
  • Loading branch information
afshin authored May 6, 2023
2 parents 3b463d7 + 1d49ebd commit 816e001
Show file tree
Hide file tree
Showing 16 changed files with 782 additions and 412 deletions.
3 changes: 0 additions & 3 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,6 @@ We are essentially sub-dividing semver to allow us to bump minor versions
of the JS packages as many times as we need to for minor releases of the
top level JupyterLab application.

Other note: It's ok if `yarn-deduplicate` exits with a non zero code. This is
expected!

#### JS major release(s)

In a major Python release, we can have one or more JavaScript packages also have
Expand Down
4 changes: 3 additions & 1 deletion buildutils/src/update-core-mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ fs.copySync(
);
process.env.YARN_UNSAFE_HTTP_WHITELIST = '0.0.0.0';
utils.run('jlpm', { cwd: staging });
utils.run('jlpm dedupe', { cwd: staging });
utils.run('jlpm dlx yarn-berry-deduplicate --strategy fewerHighest', {
cwd: staging
});

// Build the core assets.
utils.run('jlpm run build:prod:release', { cwd: staging });
Expand Down
3 changes: 1 addition & 2 deletions dev_mode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,7 @@
"webpack-cli": "^5.0.1",
"webpack-merge": "^5.8.0",
"whatwg-fetch": "^3.0.0",
"worker-loader": "^3.0.2",
"yarn-deduplicate": "^5.0.0"
"worker-loader": "^3.0.2"
},
"engines": {
"node": ">=18.0.0"
Expand Down
11 changes: 11 additions & 0 deletions docs/source/developer/performance.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ However code cell outputs bring a huge constraint that their internal state is w
DOM node (e.g. the zoom level on a map view). So the outputs cannot be detached once displayed
With those considerations in mind, here is the algorithm coded for the notebook windowing.

.. note::

When initializing the view, the code cell outputs are scanned to detect if they contain
``text/html`` output defining ``style`` and/or ``scripts`` elements. If they do, those
cells are rendered to ensure styles and JavaScript are applied as they may leak outside
their definition cell (e.g. injection of custom styles).

When cell widgets are instantiated, their children are not created (i.e. the editor, the
outputs,…) and they are not attached to the DOM. The view is updated on scroll events following:

Expand Down Expand Up @@ -70,6 +77,10 @@ Side effect of the implementation
the UI may freeze as all outputs never rendered will need to be rendered.
- The cell editor is available only for cell that have been at least once in the viewport.
The editor is not destroyed when the cells are out of the viewport. So its state can be modified.
- HTML element measurements cannot capture margins. Therefore the cell containers should not use it.
Padding is the solution as measurements is limited to border sizing. This is because top and bottom
margins between adjacent elements `can be collapsed <https://developer.mozilla.org/en-US/docs/Web/CSS/margin#margin_collapsing>`__
by the web browsers.

Viewport state
^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion docs/source/extension/extension_migration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ is to force packages deduplication using:

.. code-block:: sh
jlpm dedupe --strategy highest
jlpm dlx yarn-berry-deduplicate
API breaking changes
^^^^^^^^^^^^^^^^^^^^
Expand Down
40 changes: 32 additions & 8 deletions docs/source/getting_started/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,38 @@ General
JupyterLab? <https://jupyterlab.readthedocs.io>`__
- :ref:`How can you report a bug or issue? <issue>`

Usage
-----

Notebook
^^^^^^^^

My notebook is displaying cell outputs in an `iframe <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe>`__. They are reset when scrolling back and forth.

Since JupyterLab v4, notebook rendering is optimized to display only the cells needed.
This has side effects with iframes.

The current workaround is to set the settings *Notebook* => *Windowing mode* to ``defer`` or ``none``.
It will negatively impact the performance of JupyterLab when opening long notebooks and/or lots of files.

My notebook injects customized CSS that results in unexpected scrolling issues (e.g. it fails to scroll to the active cell).

Since JupyterLab v4, notebook rendering is optimized to display only the cells needed.
It does not support changing element CSS `margin <https://developer.mozilla.org/en-US/docs/Web/CSS/margin>`__
(in particular for cells).

The workaround is to prefer injecting customized `padding <https://developer.mozilla.org/en-US/docs/Web/CSS/padding>`__ rather than *margin*.
If you can not avoid changing the margins, you can set the settings *Notebook* => *Windowing mode* to ``defer`` or ``none``.
It will negatively impact the performance of JupyterLab when opening long notebooks and/or lots of files.

Tips and Tricks
---------------

- How do I start JupyterLab with a clean workspace every time?

Add ``'c.ServerApp.default_url = '/lab?reset'`` to your ``jupyter_server_config.py``.
See `How to create a jupyter_server_config.py <https://jupyter-server.readthedocs.io/en/latest/users/configuration.html>`__ for more information.


Development
-----------
Expand All @@ -34,11 +66,3 @@ Development
API from the Javascript renderer, because this would tie the kernel and the notebook output to JupyterLab
and make it hard for other frontends to support it.
If you have comments or suggestions on changes here, please comment on `this issue <https://github.com/jupyterlab/jupyterlab/issues/4623>`__.


Tips and Tricks
---------------

- How do I start JupyterLab with a clean workspace every time?

Add ``'c.ServerApp.default_url = '/lab?reset'`` to your ``jupyter_server_config.py``. See `How to create a jupyter_server_config.py <https://jupyter-server.readthedocs.io/en/latest/users/configuration.html>`__ for more information.
27 changes: 27 additions & 0 deletions galata/src/helpers/notebook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,33 @@ export class NotebookHelper {
return true;
}

/**
* Trust the active notebook
*
* @returns Whether the action succeeded or not.
*/
async trust(): Promise<boolean> {
if (
(await this.isAnyActive()) &&
(await this.page
.locator('[data-icon="ui-components:not-trusted"]')
.count()) === 1
) {
await this.page.keyboard.press('Control+Shift+C');
await this.page.getByPlaceholder('SEARCH', { exact: true }).fill('trust');
await this.page.getByText('Trust Notebook').click();
await this.page.getByRole('button', { name: 'Trust' }).click();

return (
(await this.page
.locator('[data-icon="ui-components:trusted"]')
.count()) === 1
);
}

return true;
}

/**
* Wait for notebook cells execution to finish
*
Expand Down
Loading

0 comments on commit 816e001

Please sign in to comment.