Skip to content
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

Enable Python API in the JupyterLite deployment #412

Merged
merged 21 commits into from
Feb 7, 2025

Conversation

davidbrochart
Copy link
Collaborator

@davidbrochart davidbrochart commented Jan 30, 2025

Description

Fix #369
Fix #342

Checklist

  • PR has a descriptive title and content.
  • PR description contains references to any issues the PR resolves, e.g. Resolves #XXX.
  • PR has one of the labels: documentation, bug, enhancement, feature, maintenance
  • Checks are passing.
    Failing lint checks can be resolved with:
    • pre-commit run --all-files
    • jlpm run lint

📚 Documentation preview: https://jupytergis--412.org.readthedocs.build/en/412/
💡 JupyterLite preview: https://jupytergis--412.org.readthedocs.build/en/412/lite

Copy link
Contributor

Binder 👈 Launch a Binder on branch davidbrochart/jupytergis/emscripten

Copy link
Contributor

github-actions bot commented Jan 30, 2025

Integration tests report: appsharing.space

@mfisher87
Copy link
Member

Is this change enabled by an enhancement to JupyterLite? Could you please add some context links? 🙇

@martinRenou
Copy link
Member

David is looking into making the Python API work in JupyterLite 🚀

Making good progress this week! You can give it a try here https://davidbrochart.github.io/jupytergis-demo (note not everything is working yet)

It is built from https://github.com/davidbrochart/jupytergis-demo

Once we have something stable, we should update our JupyterLite deployment with what David has there. Probably as part of this PR here?

@davidbrochart
Copy link
Collaborator Author

Yes, there are other changes that will make jupytergis_lab work in JupyterLite, currently in my branch.
The piece that allows a Python kernel to access a shared document, and the corresponding file, is my-jupyter-shared-drive: a collaborative drive that is actually not shared with anybody (it just allows to go through the underlying CRDTs to access data).

@davidbrochart davidbrochart marked this pull request as draft February 3, 2025 13:46
@davidbrochart davidbrochart force-pushed the emscripten branch 7 times, most recently from 747616f to 34006b2 Compare February 4, 2025 21:52
Copy link
Member

@martinRenou martinRenou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!! I have some suggestions

docs/conf.py Outdated Show resolved Hide resolved
docs/environment.yml Outdated Show resolved Hide resolved
docs/environment.yml Outdated Show resolved Hide resolved
docs/jupyter-lite.json Outdated Show resolved Hide resolved
@davidbrochart
Copy link
Collaborator Author

Thanks @martinRenou.
The Read the Docs build fails but I don't know why: https://readthedocs.org/api/v2/build/27080482.txt.

@davidbrochart
Copy link
Collaborator Author

Oh I see:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
sphinx-togglebutton 0.3.2 requires setuptools, which is not installed.
sphinx-togglebutton 0.3.2 requires wheel, which is not installed.
sphinx-autodoc-typehints 3.0.1 requires sphinx>=8.1.3, but you have sphinx 7.4.7 which is incompatible.
sphinx-tabs 3.4.1 requires docutils~=0.18.0, but you have docutils 0.21.2 which is incompatible.

@davidbrochart
Copy link
Collaborator Author

Now the error is:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
sphinx-autodoc-typehints 3.0.1 requires sphinx>=8.1.3, but you have sphinx 7.4.7 which is incompatible.
sphinx-tabs 3.4.1 requires docutils~=0.18.0, but you have docutils 0.21.2 which is incompatible.

.readthedocs.yaml Show resolved Hide resolved
docs/environment.yml Outdated Show resolved Hide resolved
@davidbrochart
Copy link
Collaborator Author

The JupyterLite deployment here seems to have the collaborative drive, but I suspect running the Notebook.ipynb doesn't work because of #425?

@davidbrochart
Copy link
Collaborator Author

The JupyterLite deployment here seems to have the collaborative drive, but I suspect running the Notebook.ipynb doesn't work because of #425?

Yes, it works with 7dc7400.
So we should think about kernel vs Jupyter paths now.

@martinRenou
Copy link
Member

Rebased from the UI

@martinRenou
Copy link
Member

martinRenou commented Feb 6, 2025

I just pushed two new commits (+ the linter one)

  • Show an error dialog in the front-end if no collaborative drive is there 946e34d this comes as a replacement for the old import error we were showing in Python
  • Handle file operations from the front-end instead of in Python 8181441

This works only with QuantStack/yjs-widgets#22

Case 1: Open an existing file (path is relative to the current context aka Notebook)

Uploading Screencast From 2025-02-06 18-25-05.mp4…

Upload doesn't work, but hey it's working

Case 2: Open a non-existing file, we create it (path is relative to the current context aka Notebook)

Screencast.From.2025-02-06.18-21-38.mp4

Case 3: Open without passing a file path, we don't create anything

Screencast.From.2025-02-06.18-24-32.mp4

@martinRenou martinRenou self-assigned this Feb 7, 2025
@martinRenou martinRenou marked this pull request as ready for review February 7, 2025 09:48
@martinRenou martinRenou changed the title Enable jupytergis_lab in WASM platform Enable Python API in the JupyterLite deployment Feb 7, 2025
@martinRenou martinRenou added enhancement New feature or request and removed maintenance labels Feb 7, 2025
Copy link
Member

@martinRenou martinRenou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we're hitting flaky visual regression test, let's go ahead with this!!

Thanks David

@martinRenou martinRenou merged commit 89e4de9 into geojupyter:main Feb 7, 2025
14 of 15 checks passed
import {
IJupyterYWidget,
IJupyterYWidgetManager,
JupyterYDoc,
// JupyterYDoc,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// JupyterYDoc,

@matthewfeickert
Copy link
Contributor

Awesome to see! Thanks for this great work.

@davidbrochart davidbrochart deleted the emscripten branch February 7, 2025 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants