How to write extension that supports both JupyterLab 1.0 & 2.0?

I see that JupyteLab 2.0 release candidate is out and the extension needs to be updated to work with 2.0.

I am writing a new extension and was wondering if it’s possible to write it in a way that can install & work with both JupyterLab 1.0 & 2.0? I am OK with making separate source files (in the same package) that goes with each version.

Thank you for your guidance.

3 Likes

JLab tries to intelligently search for the latest extension that is compatible, so you should be able to publish, for example, a 1.x version for JLab 1.0 and a 2.x version for JLab 2.0. If you are relying on APIs that have changed, this is the route you’ll likely have to take (maintain two branches of your codebase, published to two different major versions of your extension).

If https://github.com/jupyterlab/jupyterlab/pull/7893 is merged, you might be able to support both JLab 1.0 and JLab 2.0 from the exact same codebase, if the APIs have not changed in JLab 2.0. But that would entirely depend on the API you are interacting with.

3 Likes

JLab tries to intelligently search for the latest extension that is compatible, so you should be able to publish, for example, a 1.x version for JLab 1.0 and a 2.x version for JLab 2.0.

Awesome!

@jasongrout That makes sense. Thank you for a quick response.