-
Notifications
You must be signed in to change notification settings - Fork 30
Investigate a Cylc UI within JupyterLab #374
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
Comments
Did some experimentation with JupyterLab yesterday and posted to Element. Almost forgot to write here too, if it were not for @hjoliver reminding me (thanks! 👍 ) Went as far as I could with GScan in JupyterLab. It almost worked: https://github.com/kinow/cylc-gscan issues:
There are several benefits of moving to JupyterLab. I listed the issues I found, but they are not really blockers (if we have time), just things that would need to be reviewed/clarified if/when considering the move 👍️ (which would be really fun IMO 😬). |
Good to hear your updates! There will be a lot more information about JupyterLab 3 soon, but my take is: greenfields stuff should start in JupyterLab 3, as the end-user experience of
What libraries in specific? You should generally get your own copy of your own stuff React is not required for building new greenfields JupyterLab extensions... and the
I don't know what I don't know about vue, but if the relationship is 1-root-node-to-1-app, that might have to be the way
The "improvement" for users: there is no build. For devs: the build occurs only in the scope of your package and core, and
https://jupyterlab.readthedocs.io/en/stable/developer/extension_dev.html#extension-authoring A fairly bog-standard lab 2 extension might have a workflow like this: jlpm
jlpm build # this could be tsc + babel + webpack
jupyter labextension install .
jlpm watch # whatever you have to do to make your chain watch
jupyter lab --watch --debug # in another terminal While lab 3 will be: jlpm
jlpm build
jupyter labextension build .
jupyter labextension develop --overwrite .
jupyter labextension watch . # one terminal
jupyter lab --debug # another terminal, doesn't use node at all!
In JupyterLab 3, you'll have more flexibility, but the federation stuff has some pointy bits.
Again, don't know what I don't know, but if vue+webpack+babel can generate a "normal"
🤷?
JupyterLab doesn't use Redux, or any top-level data store. All of the existing
Aside from the above link, there's:
Both of the above have WIP JupyterLab 3 variants. So reading source of extensions and/or core extensions that do something like
TypeScript is not required for JupyterLab. Just get to a bog-standard JupyterLab uses TypeScript extensively, as it makes finding API regressions a lot easier, and If you come across a library that doesn't have typescript, you can create an empty declare module 'foo.d.ts' {} And it will import as
A couple years in: TypeScript is going to reward the maintainers of a project. It might
The
If your pieces are small (or at least self-contained), and fit nicely into UI concepts already in JupyterLab (e.g. a sidebar, a menu, a main area) it can be pretty nice. Also, if you leave extension points (exposed on your top-level plugin), others can extend your stuff. |
Sorry for the wall of text above, but good luck! Let us know how we can do a better job of enabling the kinds of cool features you want to deliver to your users! |
Thanks @bollwyvl - that will be super helpful to us 👍 |
Hi @bollwyvl !
That was super helpful (again!).
It could be that I misunderstood how JupyterLab works. I saw React in the transitive dependencies, and assumed JupyterLab was a React application? The example I was using was also using React, so I was trying to load a Vue component, without having to create a Vue application for the We have other components that would need to be converted into Lumino widgets too, so I thought the easiest way would be to leave the React app control everything, hold the data, and pass it down to Vue components. Following this train of thought, I decided to try libraries that integrate React and Lumino, like Vuera - https://github.com/akxcv/vuera. But regardless of having quite a few stars, it didn't work following their docs for installation without babel.
That should be easier then! Q: is there a way to initialize a Vue application once during the initialization of JupyterLab JS/TS application? This would be easier for us to transition, if I had an initialization hook where I could load a Vue app. function jupyterlabInit(domElement, options) {
# create a Vue app, loading Vuetify for CSS components and Vuex for the central store
new Vue({
el: domElement,
...options
})
} After that the widgets for "Tree" and "Graph" etc for Cylc workflows would just need to be kept in sync with the Vue components (which we are doing already with code similar to this - https://github.com/tupilabs/vue-lumino).
All good. Vue provides ways to customize webpack and babel, but it's not super straightforward. Devs are given a chance to include/delete/edit parts of the chain of execution in webpack/babel. Which doesn't always work, but is good enough for enabling features, loading new plugins, etc. From what I saw in some open issues in jupyterlab looks like it will solve the issues I had once it's avaialble/fixed.
I had seen the cookiecutter (I think I used it to create cylc-gscan repo), but don't recall seeing https://github.com/jupyterlab/extension-examples! Lots of useful examples, thanks!
👍 that's exactly how I learned Jenkins extension points. By finding the plugins doing what I wanted, and reading the source code.
Ah! I can do that? I thought it had a hard requirement in the extension being written in TS! It will be much easier to start with JS.
👍 I spent most of my time as dev writing Java, and later jumped to PHP/Py/JS, so I'm definitely +1 for TS, type checking, etc, for less bugs.
I kind of understood that part from past experiments. But I still get confused whenever I see these I added one for Vue after I had a build error, but I got that from a StackOverflow I believe - https://github.com/kinow/cylc-gscan/blob/3c14245623dd0552f48020fb852b603d7f882203/src/vue-shim.d.ts
Sorry, this was me thinking that JupyterLab was a React app. Our user interface at the moment uses CSS/HTML components provided by Vuetify. In order to keep the look and feel, and perhaps re-use some of what we created, it would be easier to use some library that implemented the Google Material Design, but worked with React (as Vuetify is Vue only). But looks like if we use JupyterLab 3 we can do whatever we want, even keep using Vue + Vuetify, or vanilla JS/TS with some other CSS library, or write our own scss/css layout.
That doesn't look too bad IMO, as I think maintaining the code will be much simpler 🙏
Any way to get the currently logged-in user, if any? I see only the URL in But we also need the user name for GraphQL queries.
How do you handle if you have multiple Lumino widgets that need the same data? Or if you have an extension like GScan in the side panel, would it be possible to share the data from GScan with widgets created? Thanks a lot @bollwyvl ! I've got a lot to learn (though most of that is fun to learn! 🎉 🤓 ) |
Oh, almost forgot. @bollwyvl any good documentation on updating an extension project from JLab2 to JLab3, please? Just to know whether it will be easy to update, or if I should wait or use the existing JLab3 code for the extension. |
I believe the migration guides are in lab master, etc. but again, cranking
the cookiecutter with "--checkout 3.0", getting up to the watch command and
playing with stuff can be the most informative.
It's always hard to make some of these calls. While the individual js/css
might change very little, the boilerplate is very different... As would be
the eventual end user documentation. But going from a section of "install
nodejs and jump through these hoops" to a line of "pip install" is
priceless.
|
Describe exactly what you would like to see in an upcoming release
From comments in this PR: #90
The pull request was closed, but there was a different approach, suggested by @bollwyvl, where we could actually have the Cylc UI within JupyterLab.
JupyterLab is extensible, and allows widgets/plugins to customize and manipulate the interface. As we already use JupyterHub for authentication and starting and managing the UI Server, perhaps that would be a good idea too.
Additional context
Pull requests welcome!
The text was updated successfully, but these errors were encountered: