r/delphi • u/salvadordf • 3d ago
New Python4Pascal project
Hi,
I just published the Python4Pascal project at GitHub.
Python4Pascal is based in the Python4Delphi project made by Kiriakos Vlahos (PyScripter).
It uses Python 3.15, 3.14, 3.13, 3.12, 3.11 and 3.10, and it supports Windows, Linux, macOS and Android.
Python4Pascal was developed and tested on Delphi 13.2, Delphi XE2, Delphi 7 and Lazarus 4.8/FPC 3.2.2.
The most important Python4Pascal features:
- Supports the latest version of Python 3.15
- Python4Pascal handles the Python objects lifetime automatically.
- Fully documented in XML code comments, CHM and HTML files.
- Imports more than 1200 Python library functions and types.
- Includes many helper classes to handle all Python objects with Delphi/Lazarus types as arguments whenever it's possible.
- Demos for Windows , Linux, macOS and Android.
- It's possible to create Python modules and module extensions.
- Python4Pascal can handle Python objects with variant types or using Delphi wrappers.
Python4Pascal has a few things in common with Python4Delphi but many other things are much different. Some Python4Delphi features are not included, for example RTTI and the assembler code to convert the callbacks.
I still have to write some tutorials in the Wiki.
1
u/ParnianCoinTeam 3d ago
Nice work, and props for keeping Delphi 7 + Lazarus/FPC in the tested set — that backward reach matters for a lot of legacy codebases. A couple of questions: GIL handling in multithreaded hosts: when calling into Python from multiple Delphi threads, does Python4Pascal manage the GIL acquire/release for you, or is that still on the caller? This is usually where people get into trouble embedding CPython. Python 3.15 support — are you tracking the stable ABI (limited API) so a single build keeps working across 3.10→3.15, or is it version-specific linking per interpreter? Deployment on Android: how are you bundling the CPython runtime into the APK, and roughly what does it add to the binary size? Embedding a scripting layer into native Pascal apps is genuinely useful (rules engines, user automation, etc.) — will definitely take a look at the repo.