Setting kernel environment variables from within JupyterLab extensions

No, from the server extension. So the flow is once my menu item from the frontend gets triggered (implemented in TS), it calls the backend server extension (implemented in py) which does some ‘business logic’ and writes the result to a shared file. Within the kernel now you can read the file. Custom request handlers — Jupyter Notebook 6.4.5 documentation - for creating a server extension if that suits your use case.

1 Like

Thanks a lot for your answers :pray:
One last thing, can you point me to an example where the server extension gets access to the extension settings?
Or were the settings a part of the request that was sent from TS in your case?

serverextension module uses tornado.web using which you create custom handlers (example in the link I shared above). From your frontend TS, the request is sent to that handler endpoint exposed serverside and processed followed by return.
requestUrl where the request is sent from TS.
serverside setup.

2 Likes

Thanks for all your help. I’ll be approaching this task in the near future and your experience will definitely be beneficial