We’re launching a new series of Delphi-Python Ecosystem and Python tools updates. You’ll know what we’re developing around Delphi-Python integration and how you can use those new tools in these updates.
Python4Delphi (P4D) is the core technology/package that powers the whole Delphi-Python EcoSystem. P4D has a long history of over two decades, and you can read more about it on its wiki pages.
After more than two decades of introducing Python4Delphi (P4D), we are trying to solve the essence of why the P4D project started with the PythonEnvironments project. Initially, P4D was designed to have a scripting capability in Delphi using Python. Python is a great programming language for prototyping and experimenting with an idea using short scripts. One of the reasons that the community didn’t adopt to include Python into their Delphi applications as it was not an easy process to do so.
Our Delphi-Python EcoSystem can be summarized using the below figure:
PythonEnvironments provides a set of Design time Components to embed a desirable Python Environment into your Delphi application using the readily available Python embeddable very easily.
The recent advancements in PythonEnvironments are described below.
Table of Contents
Has PythonEnvironments reached a mature state?
A few days ago, we were in the early alpha/beta stages of developing the PythonEnvironments. Now, the project is in quite a robust stage where we’re confident the community can try it out. Now, you can add a Python environment to your Delphi application and distribute it easily. In addition, we have implemented a notification protocol where you can create notifications between different events at different stages of setting the Python environment. Finally, one of the most important updates is that you can implement all of the events of PyEmbeddedEnvironment
component and loading processes of Python asynchronously.
We highly encourage you to try out the PythonEnvironments, and if you face any problems, please raise issues in the GitHub repository. Let’s embrace the power of Delphi-Python EcoSystem as a community.
Are there any PythonEnvironments examples or samples?
We have added a decent number of samples to our GitHub repository to get started with PythonEnvironments. You can find out the samples in our GitHub repository. Please try out the samples in the mentioned order in the README. Each sample is almost self-explanatory, but we shall also add explanations for all of them. You can build all of the samples for any target platform of your choice. We added a sample specifically to try out on the Android platform called SimpleAndroid.
The Python embeddable files for Android have been added
We have added the Python embeddables compiled for the Android platform for Python versions – 3.7
to 3.10
. Because of this addition, you can now easily create Python environments in your Delphi-built Android applications. You can run Python scripts to implement your applications’ data analysis tasks.
How to automate the PYTHONENVIRONMENTDIR environment variable setting?
Earlier, we need to register the PYTHONENVIRONMENTDIR environment variable in Delphi IDE for it to find the path of Python embeddables. We have now automated that process in the installation process of PythonEnvironments using a batch script.
Future updates – what’s next?
- Add wiki pages for Installation details of PythonEnvironments.
- Add detailed explanations of all of the added samples of PythonEnvironments.
- Create an architecture diagram of PythonEnvironments for the community to take part in the Development process.
- Compile P4D for Linux and make them available as dependencies in creating Linux applications using P4D.
Priyatham is one of the core maintainers and contributors for all the Delphi/Python ecosystem projects.
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition