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
Federated bundle (for JLab>=3) and source bundle (for JLlab<3) in 1 pypi package #9277
Comments
Can you check in the latest jlab 3 prerelease? Install jlab 3.0rc6 and one of your widgets packages that has the jlab 2 bundle. Does jlab 3 correctly recognize it can't use the bundle, and ignore it? |
The other way should work fine, since jlab 1 and 2 don't know anything about the new location we put federated extensions, so they should just ignore it. Doesn't hurt to test, of course. |
This was on jlab 3.0rc6 (as reported by @mariobuikhuizen).
How should it recognize that the bundle should be ignored? Because there is no dependency on jupyterlab in any of our projects, and they should be compatible with 1, 2 and 3. |
Good point. This is tricky - .tar.gz extensions are incorporated at jlab build time (federated extensions are ignored then), but federated extensions are incoporated at runtime (extensions requiring a rebuild are ignored then, unless they are already built in, in which case they are already in the browser). Another tricky thing here - in doing Perhaps one thing we can do here is to check, before building an extension into jlab, if the same federated extension is available (i.e., the same npm package name). If it is, do not build it in, preferring the federated extension. |
This doesn't solve the problem of building it in at some point, then later installing the federated version. |
Indeed, could there be a race condition, that even during a pip install, the .tar.gz gets seen, but not yet the federated bundle, and the user gets asked to rebuild? I also wonder if this enabled multiple versions of the same widget library. If so, we should probably exclude building when both the package name and the version matches (exactly or semver?). |
From the dev meeting:
|
Documenting the process of adding the federated bundle to an existing extension here for reference. So we have more details with a concrete example.
It should actually be possible to recreate a smaller example by starting from the 3.0 branch of the cookiecutter: https://github.com/jupyterlab/extension-cookiecutter-ts/tree/3.0 And adding the tgz to the data files like here: https://github.com/jupyterlab/extension-cookiecutter-ts/blob/fb827d3f438f62a1dc7566800f6b37d0d2a1fe8b/%7B%7Bcookiecutter.extension_name%7D%7D/setup.py#L34 |
Hi all, jupyterlab 3 is getting amazing :), but i'm afraid this is not fixed in v3.0.0.rc13. To reproduce (a bit elaborate because of an install issue with that branch):
This gives:
|
To add some more details, I'm now testing the updated widget package prior to a pre-release (vidartf/ipydatawidgets#43), in various conditions: Clean lab3 envIf I install it into a clean lab 3 env:
then I get greeted with a "jupyter-datawidgets needs to be included in the build" dialog at startup (since it installs both a source and pre-built extension). Everything works well other than that, since the extension is running off the prebuilt version. Running
And if I run
Updating from a lab 2 env:If I again start with a clean env, then install lab2 and some extensions, and the update lab:
then I get greeted with a "jupyter-datawidgets needs to be included in the build" dialog at startup, but things work. And if I rebuild and reload, things again stop to work (but with a different error compared to the other case):
So in conclusion, distributing both a pre-built and source extension at the same time seems messy with the current state of things. |
PS: The upgrade path might get fixed by |
So, while #9489 resolves the problem with the build check recommending a build (which is good
|
To clarify, the situation that you have is that you have:
and the lab extension system is not able to fulfill the dependency, even though both extensions are loaded. |
Those two scenarios should work since rc11 or so (with the right configuration for |
Continuing debugging in the above scenario... It turns out that It also looks like the ipydatawidgets extension is built into JupyterLab and is the actual extension run (i.e., it is not disabled, like it should be since it also exists as a prebuilt extension), which begs the question: A. If a prebuilt and source extension bundle exist, should the source extension bundle be built into jupyterlab even though we know it is shadowed by the prebuilt extension and should be disabled/ignored, or should it be ignored in the build and never built in? |
I think we should try to handle the situation where a package is both included in a build from a source extension, and also present as a prebuilt extension. Otherwise, we would also need to recommend builds to remove it if it is found from both sources. Doable, but it sounds painful. |
After a lot of craziness, it turns out that my yarn had cached an old version of ipydatawidgets with the same version number which was messing everything up. Doing a |
(Moving ipydatawidgets to a dev version number after the last release would have likely fixed the issue I saw) |
What we should make sure, though, is that one of these is disabled, even if it is present in the js in the system. |
To expand on what Jason has already has commented, I think I have seen a similar problem on 2.x sometimes: If you are developing an extension, and install it, and then make some further changes and install it again, it can sometimes use the first version you installed. Cache cleans have seemed unreliable in these cases, but that might be system dependent. I've often ended up writing a little script that bumps the version before installing, just to ensure I don't end up with a cache issue. So a developer quality of life issue, not a release issue. |
Let's open a new issue if you want to investigate the dev issue more. Thanks! |
For many python widget libraries, we put the js source tarball in
$prefix/share/jupyter/lab/extensions
. JLab 1 and 2 pick this up, and rebuild. For JLab 3, we want to put the Federated bundles into$prefix/share/jupyter/labextensions
, e.g.:However, if we want our new distributed python package to work for both JLab versions, not requiring a rebuild on 3, asking for a rebuild on 1 and 2. Is there a way to do this?
The text was updated successfully, but these errors were encountered: