r/delphi • • Oct 20 '26

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.

23 Upvotes

4 comments sorted by

View all comments

Show parent comment

3

u/salvadordf Oct 20 '26

Thanks!

The same executable using Python4Pascal can load any version from 3.10 up to 3.15. You don't have to build a different executable for each Python version.

At this moment Python4Pascal doesn't support the free threading mode so we still have to acquire/release the GIL but most of the logic is already included in the TP4PThread class. See the SimplePythonThread demo.

The SimplePythonCodeRun demo in the Delphi_FMX directory can target Android, Windows and macOS. It deploys a "python.zip" file with the official embeddable Python package for Andoird. Read the code comments in TMainForm.FormShow for all the details.

1

u/ParnianCoinTeam Oct 20 '26

Great, thanks for the thorough reply. The single-build-many-versions bit is the real win here. Will check out SimplePythonThread.