The Python Tools extension, which enhances the Python coding experience, was introduced in SAP Business Application Studio (referred to as "BAS" below) exactly two years ago. Here are my notes from using it.
This post is not a tutorial or a comprehensive guide to best practices. It’s a collection of personal notes, which I hope you find helpful when working with Python in BAS. The focus here is on running Python code in BAS, not on deploying to SAP BTP runtimes like Cloud Foundry (CF) or Kyma. This is when you are usually working on Machine Learning or AI projects in BAS, like during SAP CodeJams.
I assume you're not an absolute beginner with SAP Business Application Studio—or at least you're familiar with Visual Studio Code.
For the examples in this post, I’ll be using the SAP Business Application Studio available in the SAP BTP Trial environment.
In SAP Business Application Studio, the dev space includes a system-level Python 3 binary at /bin/python3, which is primarily intended for OS-level scripts and tooling. This version is tied to the base container image and is only updated when the image itself is refreshed.
For application development, developers typically use user-managed Python runtimes. Since January 2024, you can select the Python version with which you want to work.
SAP Business Application Studio uses asdf to allow you to select which runtime versions to install and use for developing your application. You can check this in the BAS terminal with asdf current python.
By default, SAP Business Application Studio provides only one officially supported Python version.
If you need another version of Python, you can install it with asdf install python <version>. If you want the latest minor version, then use latest:, like asdf install python latest:3.12 in the case of the 3.12 version of Python.
At the time of writing this post, the asdf version used in BAS is 0.12.0. This version uses the asdf global and asdf local commands to set the actual runtime version. If you refer to the asdf documentation, these commands have been replaced with asdf set, so don't get confused.
You can also install different versions from the command palette. Select > Runtime: Install, then Python, and the version you want to install. To set the default version of Python for execution, use the command > Runtime: Set Default.
These commands are provided by the built-in BAS Framework extension.
...using a version of Python accordingly to your requirements.
Being a fork of Visual Studio Code - Open Source ("Code - OSS")—SAP Business Application Studio provides basic support for Python files and Jupyter notebooks out of the box.
To improve your Python coding experience, SAP Business Application Studio provides an additional extension called "Python Tools". This extension includes IntelliSense, formatting, linting, and debugging support for Python files and Jupyter notebooks.
To add "Python Tools" to your BAS dev space, go to the configuration of a stopped or a newly created dev space, and select Python Tools from Additional SAP Extensions.
Upon activation, you should see additional extensions listed now as built-in in BAS.
Note that BAS installs its extensions from Open VSX, an open-source registry for VS Code extensions. VS Code's Python extension is available at: https://open-vsx.org/extension/ms-python/python.
You can see Python extensions in the file system:
ls -lad /extbin/local/openvscode-server/extensions/ms-py*These are extensions selected and integrated by the BAS product team at SAP.
You can install other versions of the same extensions directly from https://open-vsx.org/, but there is no guarantee that they have been tested and will properly work with BAS. First of all, the extension version installed directly from the marketplace should be compatible with the version of SAP Business Application Studio (or the "Code—OSS" to be more precise).
For example, at the time of writing this post, the version of the Python extension at the VSX marketplace is 2025.04...
which is compatible with version 1.94.0 of Code-OSS and therefore BAS: https://github.com/microsoft/vscode-python/blob/v2025.4.0/package.json#L50
Upon installation of the Python extension in BAS, you can:
1/ Execute Python extension's commands from the palette:
2/ Trigger an execution of a program from the editor:
...which you can configure by editing the python.terminal settings:
3/ modify its @ext:ms-python.python settings:
To run your code, you usually need additional Python packages, such as the Python machine learning client for SAP HANA (hana-ml) or SAP Cloud SDK for AI (Python).
If you have experience with Python, then you already know all the advantages of using virtual environments. Although you can think of BAS devspace as an isolated project development environment, there is a good reason to use Python virtual environments there, as I already explained in Persisting Python environment in SAP Business Application Studio.
An additional reason to use a virtual environment is if you plan to test or run your project using different versions of Python managed by asdf. Each of the installed versions of Python will use their own location to store packages:
Please share your tips in the comments!
------
-Vitaliy, aka @Sygyzmundovych
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 48 | |
| 47 | |
| 37 | |
| 34 | |
| 29 | |
| 23 | |
| 22 | |
| 22 | |
| 22 | |
| 21 |