August 7th 2025: Python sessions

Recording of the first part of the meeting

Links and commands mentioned in video

Help page for VS code tunnel in an ubuntu session

Commands shown for installing and running VS code in a Python session terminal:

mkdir vscode_cli
cd vscode_cli
curl -L "https://update.code.visualstudio.com/latest/cli-linux-x64/stable" -o vscode-cli.tar.gz
tar -xzf vscode-cli.tar.gz
./code tunnel

Machine-generated transcript

Hi everyone and welcome to this power user meeting. We will go through some features first and then we will also have a bit of a session where people can ask questions, and in general if you experienced any bugs you can report them to us. But sort of what we plan to go through today is the Python sessions that we have available on the platform.  We will talk a bit about how you create a Python session, how you can work in a local editor and then also maybe have a discussion if any people have ideas for how we should have Python jobs working in the future. I don't know if anyone noticed but currently if you try and create a job you can only select a system environment.

It would be nice, I think, if we have some version of Python jobs working as well on the platform. Creating a Python session, in case anyone has not tried it yet, is fairly simple. You essentially have a requirements file defining which modules should be included. You can also give the specific version as we have in the example here.  And then you can upload support files as well. And those can be either a Python script or a Jupyter notebook in case you want some default analysis script included in the environment by default. You also have to choose a Python version. And once you build this environment, you then have this really nice container that you can share with your colleagues and where the specific module versions are always the same and you're all working on the sort of the same basis.

This I think is fairly straightforward and this is something that most people are familiar with. Then sort of an extra thing is that in certain cases you can also install things directly from GitHub and that you can do that with this kind of formatting. So you'd have git plus and then the link to the repository. Moving to the tips and tricks sections of our presentations. Here we just want to show sort of a different kind of workflow. So it's also possible to work in a local editor instead of the Jupyter notebook that you can access through a session. And this can be really helpful if for example you are working from a place where you don't have the best internet connection. So you experience a lot of lag through the Jupyter notebook that's on the cloud.

So here you would instead have an editor in your local browser. We have already shown something similar in the Ubuntu session using VS code and we will essentially do the same thing here just inside a Python session. So once you have opened your Python session for the first time, you will have a view like this and you will start by choosing a terminal. Then similar to what one does in the Ubuntu environment case, you would have to install VS code and we then do purely through the terminal.

So you put in the following link to download the latest version and you then untar the tar ball that you downloaded. An important thing here is that you make a new directory as a destination where you download this file to and it is because that when you untar you get an executable named code and we already have a folder named code by default in the Python environment.  So it can get confused if you don't put it into a subfolder. But once you've done this, you can then just run this code executable that you get from the tab. So you just do code tunnel inside the subfolder and that will then run Visual Studio Code in a terminal version. The first time you do this within a session, you will have to authenticate. So you can do that either through your Microsoft account or through GitHub.

In this case I did it with GitHub. It will just open a new tab in your browser and you'll have to do some authentication and then you'll have to give a name to the machine. So to this session you're running. and once you've done that it will show this link and if you press that link it will open a new tab in your browser where you can then use.  So that means you also don't need to install VS Code on your local machine if you want to try and run this on your local machine. You will then also have to authenticate again and that's to make sure that it's the same person who's working in the Jupyter notebook in cloud as well as on the local machine. and here is a view of what it looks like.

So the first time when you open this, it will ask you to select a kernel. And here the one that's the DECTRIS CLOUD one is the one that has this long random string. So if you select that, you will afterwards be able to execute code, meaning that you have an editor that's on your local machine, but the code you are executing is running on the machine in the cloud.  Here  I was just testing that some of the modules that I had in my environment were available, which they were. And I also checked that the host name was actually DECTRIS CLOUD. So that was just a small tip in case it will be helpful for anyone to run the Python sessions with another editor. Another item we had on our agenda was to discuss Python jobs.

So in case anyone has any input to how they would want that to look like, they can come forward with it now, you can also always send us suggestions through the formula on the web app or you can also type in the chat if you want and we will look at it. 

Was this article helpful?