-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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
[WIP] jupyter editor including extensions #50858
Conversation
Extensions: - ipyvolume - @jupyter-widgets/jupyterlab-manager - @jupyterlab/fasta-extension - @jupyterlab/geojson-extension - @jupyterlab/git - @jupyterlab/hub-extension - @jupyterlab/katex-extension - @jupyterlab/latex - @jupyterlab/mathjax3-extension - @jupyterlab/plotly-extension - @jupyterlab/toc - @jupyterlab/vega2-extension - @jupyterlab/vega3-extension - @jupyterlab/xkcd-extension - jupyter-leaflet - jupyter-matplotlib - jupyter-threejs - jupyter-webrtc - jupyterlab-datawidgets - jupyterlab-drawio
@MMesch currently this PR allows you to |
ok. I'll test it tomorrow |
I bumped the jupyterlab version: afterwards this dirty shell seems to work!
|
Good! So it looks like link will work just fine. Also if |
Here is a working you can run it with:
Do you want to pull these commits in your PR @costrouc ? I think the proof of concept is convincing. To make this useable, we need to have all the functionality that you have in your other PR. Also we should probably pin the versions of the extensions if possible. |
latest commit: https://github.com/MMesch/nixpkgs/tree/MMesch/jupyter-npm-extensions with this
it can be started with |
Thanks for this work! It will need to be added to the Jupiter editor derivation https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/editors/jupyter. Most likely an |
I have a semi working implementation of this. I got This will lead to a PR with better python 3 support for jupyter (newest releases are python 3.5+ only). Addition of 3 kernels (c, go, ansible) and 20 jupyterlab extensions. Also will have an editor that has a clean way to add kernels and extensions. This will be a big PR but I am finding that they all depend on each other. |
looking forward to seeing it! |
any news from this @costrouc ? Feel free to tell me if you could use help. |
I could use help. But it was harder than I initially thought. Using the |
Do you have a branch that I could look at for experiments? |
Not sure if it will be much help but here is the big PR that I was working on https://github.com/costrouc/nixpkgs/tree/costrouc/jupyterlab-extension-kernels |
Does this recent work by TweagIO help? https://github.com/tweag/jupyterWith |
We understood the build process of jupyterlab quite well now I think. But it is not clear to me yet how this can be integrated into nixpkgs. The crucial point right now is still how to add the extensions: When an extension is added to jupyterlab (e.g. with It is the resolver step that is most difficult to reproduce with nix. Probably we won't be able to do so. For jupyterWith, we therefore jump in after the resolver and prebuild jupyterlab with the required extensions with its own build process. We also added an impure nix function wrapper around this but it can't be run when sandboxing is activated. So how could we integrate this into nixpgs? I am not sure and I certainly don't have enough experience for it. The only idea that we had so far is to resolve jupyterlab with all extensions that we can find. The resolved yarn.lock file could be distributed with nixpkgs and built with yarn2nix (for example) and webpack. All extensions could be disabled by default and the user selects the ones that he wants. (We should explore Also linking tweag/jupyenv#4 and @guaraqe . |
@MMesch thanks for posting here! I was looking at your work over the weekend and I REALLY appreciate it. Wish that I had more time at the moment to help with that specific project. Yes when I was working it on it in the past I too remember I have some connections with jupyterlab development and I would like to talk to the people there about this problem. |
Hey all, I work on JupyterLab and wanted to chime in here. You both seem to understand the situation pretty well.
Exactly. Every combination of package versions and JupyterLab versions requires a new build and they are not composable. What I mean is that you can't build a package with a certain version of jupyterlab and somehow combine that with building another package with that some version of jupyterlab. The only way to combine it is to install both extensions and run build. We have many related issues open around this topic, but I think the most relevent is jupyterlab/jupyterlab#5672 "Create and install extensions without Webpack". The TLDR is that when we install multiple extensions we de-duplicate and flatten the resulting dependency tree and then build that all together into one output. This means changing one extension requires rebuilding everything. If anyone wants to put cycles towards fixing that in core, or wants to explore that space, I will happily help them get up to speed on that and work with them. |
Hi @saulshanabrook , good to have your opinion on this! I just want to clarify that I see the resolver step as the problem and not the build process. The yarn resolver makes everything impure. Once we have a yarn.lock file with the precise dependencies, we can probably build with yarn2nix and webpack ourselves. On the other hand, you could argue that we wouldn't win anything compared to distributing a prebuilt app directory. The only advantage that I see is that we could include a yarn.lock into nixpkgs but hardly any prebuild javascript code. As a dirty hack, we could then potentially deselect extensions that we don't want with a nix function, which brings me to my second point: could we resolve a large set of extensions and then just build with a few of them? Or deactivate them selectively from the web interface? This would allow us to make the whole derivation pure because it requires only a single yarn.lock instead of all version combinations. We would just have a single set of curated extensions that work together from which the user can chose the ones that he wants. Of course this doesn't work if someone wants to install a custom extension. I think jupyterWith works quite well so far. Derivations are cached, we can compose kernels with packages and libraries and we can have extensions (with an impure step before caching). What is missing is how we can make this completely pure and how we can include it in nixpkgs without distributing prebundled javascript code. On the other hand, I was wondering if it wouldn't be easiest to just distribute a Jupyterlab version with a list of curated extensions. A bit like inkscape, gimp, dia or other programs that are packaged for linux. This might also be interesting for other use cases. Would the Jupyterlab team be interested in this @saulshanabrook ? |
@costrouc : How do you think we should proceed? Should we start implementing other kernels (for example including your work) in jupyterWith to setup something that works for now? We can merge the whole package into nixpkgs once it is clear how to deal with the extensions. The advantage would be that it is usable immediately, and we can also experiment a bit more with the code before getting it into the main repo. Another option would be to immediately work on a jupyterWith function in a nixpkgs branch and work on it there. |
@MMesch you are right the non deterministic step is the yarn lock file. When I was working with fixing the version of each extension I ran into issues with npm vesions of each package being incompatible with the jupyter lab version. I think that lab extensions at this point are a hard problem to solve and would require a lot of work on nixpkgs side or work on jupyterlab's side. I don't think this is something we could hope to solve easily and we already know it has an easy fix of using an impure derivation which I don't think is a deal breaker. So maybe focus on the areas that we know we can improve? Support for more kernels (making them easy to include) and adding the python packages that are included with some labextensions? For example jupyterlab-git requires a pypi package |
ok I agree. Let's fill up jupyterWith then. Shall we somehow integrate the work that you have done in #49807 ? In parallel we can setup a nixpkgs branch to test how it can be integrated smoothly ... |
Yes I think there are a few new kernels in that PR. If I remember right nixpkgs will require a few additional packages to have those kernels. |
This sounds like a great idea! I think creating a large JupyterLab distribution with a bunch of extensions installed would also be generally useful to the larger community. One way to package this to make it accessible to folks outside of the nix ecosystem would be to publish PyPi and Conda packages that have all the other packages installed (i.e. ship with the built JS files). @jasongrout do you know of any other efforts creating a large JupyterLab distribution with a bunch of pre-included extensions? We have a "Extension Manager" that you can enable to allow disabling/enabling (along with installing/uninstalling) extensions from the UI: |
@jonmmease worked on a jlab distribution something with lots of plugins installed. There are probably also various institutional efforts that are doing similar things in their internal platforms. |
This is great thanks for sharing! Definitely something I plan to check out and see how this can be integrated with nix. |
This WIP will be working on #49807 and valuable input from @MMesch. The idea is to bundle extend the
jupyter
editor with `extensions support. This requires several steps.extensions
(npm packages) and node packages (15 included for now)jupyter labextension link <derivation>
and build withwebpack
.Linking extensions allows for each npm package to be included separately.
--app-dir
andJUPYTERLAB_DIR
control the directory that jupyterlab uses.Motivation for this change
See #49807
Things done
See above.
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)