From c8ff9012a3c1d6252cd56aa0996e5ce68cb519fb Mon Sep 17 00:00:00 2001 From: lmbelo Date: Tue, 19 Nov 2024 07:25:21 -0300 Subject: [PATCH 1/2] Including Python 3.13 --- .../PyEnvironment.Project.IDE.Deploy.Android.pas | 10 ++++++++-- .../PyEnvironment.Project.IDE.Deploy.AndroidARM.pas | 9 +++++---- .../PyEnvironment.Project.IDE.Deploy.AndroidARM64.pas | 9 +++++---- .../PyEnvironment.Project.IDE.Deploy.Linux64.pas | 11 ++++++----- .../OSX/PyEnvironment.Project.IDE.Deploy.OSX.pas | 3 ++- .../IDE/Deploy/PyEnvironment.Project.IDE.Deploy.pas | 4 ++-- .../PyEnvironment.Project.IDE.Deploy.Windows32.pas | 11 ++++++----- .../PyEnvironment.Project.IDE.Deploy.Windows64.pas | 11 ++++++----- .../PyEnvironment.Project.IDE.Deploy.iOSDevice64.pas | 3 ++- .../PyEnvironment.Project.IDE.Deploy.iOSSimARM64.pas | 3 ++- 10 files changed, 44 insertions(+), 30 deletions(-) diff --git a/src/Project/IDE/Deploy/Android/PyEnvironment.Project.IDE.Deploy.Android.pas b/src/Project/IDE/Deploy/Android/PyEnvironment.Project.IDE.Deploy.Android.pas index 4101757..c05f83a 100644 --- a/src/Project/IDE/Deploy/Android/PyEnvironment.Project.IDE.Deploy.Android.pas +++ b/src/Project/IDE/Deploy/Android/PyEnvironment.Project.IDE.Deploy.Android.pas @@ -140,7 +140,13 @@ function TPyEnvironmentProjectDeployAndroid.MakeAssetsFromZip: TArray; LZip.Open(LocatePythonBundle(), TZipMode.zmRead); // Is the libpythonxx.so.1.0 the real one? - if LZip.IndexOf(Format('lib/libpython%s.so.1.0', [GetPythonVersion()])) >= 0 then begin + var LLibFileName := String.Empty; + if LZip.IndexOf(Format('lib/libpython%s.so.1.0', [GetPythonVersion()])) >= 0 then + LLibFileName := 'lib/libpython%s.so.1.0' + else if LZip.IndexOf(Format('lib/libpython%s.so', [GetPythonVersion()])) >= 0 then + LLibFileName := 'lib/libpython%s.so'; + + if not LLibFileName.IsEmpty() then begin var LAssetFileName := TPath.Combine( GetAssetsFolder(GetPythonVersion()), Format('libpython%s.so', [GetPythonVersion()])); @@ -150,7 +156,7 @@ function TPyEnvironmentProjectDeployAndroid.MakeAssetsFromZip: TArray; var LAssetStream := TFileStream.Create(LAssetFileName, fmCreate); try - LZip.Read(Format('lib/libpython%s.so.1.0', [GetPythonVersion()]), LStream, LLocalHeader); + LZip.Read(Format(LLibFileName, [GetPythonVersion()]), LStream, LLocalHeader); LAssetStream.CopyFrom(LStream, LStream.Size); finally LAssetStream.Free; diff --git a/src/Project/IDE/Deploy/Android/PyEnvironment.Project.IDE.Deploy.AndroidARM.pas b/src/Project/IDE/Deploy/Android/PyEnvironment.Project.IDE.Deploy.AndroidARM.pas index 97d5eea..b2bbe8a 100644 --- a/src/Project/IDE/Deploy/Android/PyEnvironment.Project.IDE.Deploy.AndroidARM.pas +++ b/src/Project/IDE/Deploy/Android/PyEnvironment.Project.IDE.Deploy.AndroidARM.pas @@ -60,12 +60,13 @@ function TPyEnvironmentProjectDeployAndroidARM.GetPlatform: TPyEnvironmentProjec function TPyEnvironmentProjectDeployAndroidARM.GetPythonBundleName: string; begin - case IndexStr(GetPythonVersion(), ['3.8', '3.9', '3.10', '3.11', '3.12']) of + case IndexStr(GetPythonVersion(), ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']) of 0: Result := 'python3-android-3.8.16-arm.zip'; 1: Result := 'python3-android-3.9.16-arm.zip'; - 2: Result := 'python3-android-3.10.7-arm.zip'; - 3: Result := 'python3-android-3.11.2-arm.zip'; - 4: Result := 'python3-android-3.12.0-arm.zip'; + 2: Result := 'python3-android-3.10.11-arm.zip'; + 3: Result := 'python3-android-3.11.9-arm.zip'; + 4: Result := 'python3-android-3.12.7-arm.zip'; + 5: Result := 'python3-android-3.13.0-arm.zip'; else Result := String.Empty; end; diff --git a/src/Project/IDE/Deploy/Android/PyEnvironment.Project.IDE.Deploy.AndroidARM64.pas b/src/Project/IDE/Deploy/Android/PyEnvironment.Project.IDE.Deploy.AndroidARM64.pas index 64369b5..6e81558 100644 --- a/src/Project/IDE/Deploy/Android/PyEnvironment.Project.IDE.Deploy.AndroidARM64.pas +++ b/src/Project/IDE/Deploy/Android/PyEnvironment.Project.IDE.Deploy.AndroidARM64.pas @@ -76,12 +76,13 @@ function TPyEnvironmentProjectDeployAndroidARM64.GetPlatform: TPyEnvironmentProj function TPyEnvironmentProjectDeployAndroidARM64.GetPythonBundleName: string; begin - case IndexStr(GetPythonVersion(), ['3.8', '3.9', '3.10', '3.11', '3.12']) of + case IndexStr(GetPythonVersion(), ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']) of 0: Result := 'python3-android-3.8.16-arm64.zip'; 1: Result := 'python3-android-3.9.16-arm64.zip'; - 2: Result := 'python3-android-3.10.7-arm64.zip'; - 3: Result := 'python3-android-3.11.2-arm64.zip'; - 4: Result := 'python3-android-3.12.0-arm64.zip'; + 2: Result := 'python3-android-3.10.11-arm64.zip'; + 3: Result := 'python3-android-3.11.9-arm64.zip'; + 4: Result := 'python3-android-3.12.7-arm64.zip'; + 5: Result := 'python3-android-3.13.0-arm64.zip'; else Result := String.Empty; end; diff --git a/src/Project/IDE/Deploy/Linux/PyEnvironment.Project.IDE.Deploy.Linux64.pas b/src/Project/IDE/Deploy/Linux/PyEnvironment.Project.IDE.Deploy.Linux64.pas index d3db7bc..fd37ef1 100644 --- a/src/Project/IDE/Deploy/Linux/PyEnvironment.Project.IDE.Deploy.Linux64.pas +++ b/src/Project/IDE/Deploy/Linux/PyEnvironment.Project.IDE.Deploy.Linux64.pas @@ -9,7 +9,7 @@ (* *) (* Project page: https://github.com/Embarcadero/PythonEnviroments *) (**************************************************************************) -(* Functionality: Make deployables for Android *) +(* Functionality: Make deployables for Linux *) (* *) (* *) (**************************************************************************) @@ -59,12 +59,13 @@ function TPyEnvironmentProjectDeployLinux64.GetPlatform: TPyEnvironmentProjectPl function TPyEnvironmentProjectDeployLinux64.GetPythonBundleName: string; begin - case IndexStr(GetPythonVersion(), ['3.8', '3.9', '3.10', '3.11', '3.12']) of + case IndexStr(GetPythonVersion(), ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']) of 0: Result := 'python3-linux-3.8.16-x86_64.zip'; 1: Result := 'python3-linux-3.9.16-x86_64.zip'; - 2: Result := 'python3-linux-3.10.9-x86_64.zip'; - 3: Result := 'python3-linux-3.11.2-x86_64.zip'; - 4: Result := 'python3-linux-3.12.0-x86_64.zip'; + 2: Result := 'python3-linux-3.10.11-x86_64.zip'; + 3: Result := 'python3-linux-3.11.9-x86_64.zip'; + 4: Result := 'python3-linux-3.12.7-x86_64.zip'; + 5: Result := 'python3-linux-3.13.0-x86_64.zip'; else Result := String.Empty; end; diff --git a/src/Project/IDE/Deploy/OSX/PyEnvironment.Project.IDE.Deploy.OSX.pas b/src/Project/IDE/Deploy/OSX/PyEnvironment.Project.IDE.Deploy.OSX.pas index 1ff698c..70fc4df 100644 --- a/src/Project/IDE/Deploy/OSX/PyEnvironment.Project.IDE.Deploy.OSX.pas +++ b/src/Project/IDE/Deploy/OSX/PyEnvironment.Project.IDE.Deploy.OSX.pas @@ -118,12 +118,13 @@ implementation function TPyEnvironmentProjectDeployOSX.GetPythonBundleName: string; begin - case IndexStr(GetPythonVersion(), ['3.8', '3.9', '3.10', '3.11', '3.12']) of + case IndexStr(GetPythonVersion(), ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']) of 0: Result := 'python3-macos-3.8.18-universal2.zip'; 1: Result := 'python3-macos-3.9.18-universal2.zip'; 2: Result := 'python3-macos-3.10.13-universal2.zip'; 3: Result := 'python3-macos-3.11.6-universal2.zip'; 4: Result := 'python3-macos-3.12.0-universal2.zip'; + 5: Result := 'python3-macos-3.13.0-universal2.zip'; else Result := String.Empty; end; diff --git a/src/Project/IDE/Deploy/PyEnvironment.Project.IDE.Deploy.pas b/src/Project/IDE/Deploy/PyEnvironment.Project.IDE.Deploy.pas index 11ac5c4..70f8640 100644 --- a/src/Project/IDE/Deploy/PyEnvironment.Project.IDE.Deploy.pas +++ b/src/Project/IDE/Deploy/PyEnvironment.Project.IDE.Deploy.pas @@ -82,7 +82,7 @@ TPyEnvironmentProjectDeploy = class PROJECT_USE_PYTHON = 'PYTHON'; PROJECT_NO_USE_PYTHON = 'NOPYTHON'; PYTHON_ENVIRONMENT_DIR_VARIABLE = 'PYTHONENVIRONMENTDIR'; - PYTHON_VERSIONS: array[0..4] of string = ('3.8', '3.9', '3.10', '3.11', '3.12'); + PYTHON_VERSIONS: array[0..5] of string = ('3.8', '3.9', '3.10', '3.11', '3.12', '3.13'); SUPPORTED_PLATFORMS = [ TPyEnvironmentProjectPlatform.Win32, TPyEnvironmentProjectPlatform.Win64, TPyEnvironmentProjectPlatform.Android, TPyEnvironmentProjectPlatform.Android64, @@ -318,7 +318,7 @@ class procedure TPyEnvironmentProjectDeploy.GetDeployFilesAsync( var LModel: TDeployFilesModel; begin - TPythonMessage.ShowMessageView(true); + TPythonMessage.ShowMessageView(false); // Must queue this call TTask.Run( diff --git a/src/Project/IDE/Deploy/Windows/PyEnvironment.Project.IDE.Deploy.Windows32.pas b/src/Project/IDE/Deploy/Windows/PyEnvironment.Project.IDE.Deploy.Windows32.pas index 0fcb276..5b85944 100644 --- a/src/Project/IDE/Deploy/Windows/PyEnvironment.Project.IDE.Deploy.Windows32.pas +++ b/src/Project/IDE/Deploy/Windows/PyEnvironment.Project.IDE.Deploy.Windows32.pas @@ -9,7 +9,7 @@ (* *) (* Project page: https://github.com/Embarcadero/PythonEnviroments *) (**************************************************************************) -(* Functionality: Make deployables for iOS Device ARM64 *) +(* Functionality: Make deployables for Windows x86 *) (* *) (* *) (**************************************************************************) @@ -59,12 +59,13 @@ function TPyEnvironmentProjectDeployWindows32.GetPlatform: TPyEnvironmentProject function TPyEnvironmentProjectDeployWindows32.GetPythonBundleName: string; begin - case IndexStr(GetPythonVersion(), ['3.8', '3.9', '3.10', '3.11', '3.12']) of + case IndexStr(GetPythonVersion(), ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']) of 0: Result := 'python3-windows-3.8.10-win32.zip'; 1: Result := 'python3-windows-3.9.13-win32.zip'; - 2: Result := 'python3-windows-3.10.9-win32.zip'; - 3: Result := 'python3-windows-3.11.2-win32.zip'; - 4: Result := 'python3-windows-3.12.0-win32.zip'; + 2: Result := 'python3-windows-3.10.11-win32.zip'; + 3: Result := 'python3-windows-3.11.9-win32.zip'; + 4: Result := 'python3-windows-3.12.7-win32.zip'; + 5: Result := 'python3-windows-3.13.0-win32.zip'; else Result := String.Empty; end; diff --git a/src/Project/IDE/Deploy/Windows/PyEnvironment.Project.IDE.Deploy.Windows64.pas b/src/Project/IDE/Deploy/Windows/PyEnvironment.Project.IDE.Deploy.Windows64.pas index c7ba2de..009887d 100644 --- a/src/Project/IDE/Deploy/Windows/PyEnvironment.Project.IDE.Deploy.Windows64.pas +++ b/src/Project/IDE/Deploy/Windows/PyEnvironment.Project.IDE.Deploy.Windows64.pas @@ -9,7 +9,7 @@ (* *) (* Project page: https://github.com/Embarcadero/PythonEnviroments *) (**************************************************************************) -(* Functionality: Make deployables for iOS Device ARM64 *) +(* Functionality: Make deployables for Windows x64 *) (* *) (* *) (**************************************************************************) @@ -59,12 +59,13 @@ function TPyEnvironmentProjectDeployWindows64.GetPlatform: TPyEnvironmentProject function TPyEnvironmentProjectDeployWindows64.GetPythonBundleName: string; begin - case IndexStr(GetPythonVersion(), ['3.8', '3.9', '3.10', '3.11', '3.12']) of + case IndexStr(GetPythonVersion(), ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']) of 0: Result := 'python3-windows-3.8.10-amd64.zip'; 1: Result := 'python3-windows-3.9.13-amd64.zip'; - 2: Result := 'python3-windows-3.10.9-amd64.zip'; - 3: Result := 'python3-windows-3.11.2-amd64.zip'; - 4: Result := 'python3-windows-3.12.0-amd64.zip'; + 2: Result := 'python3-windows-3.10.11-amd64.zip'; + 3: Result := 'python3-windows-3.11.9-amd64.zip'; + 4: Result := 'python3-windows-3.12.7-amd64.zip'; + 5: Result := 'python3-windows-3.13.0-amd64.zip'; else Result := String.Empty; end; diff --git a/src/Project/IDE/Deploy/iOS/PyEnvironment.Project.IDE.Deploy.iOSDevice64.pas b/src/Project/IDE/Deploy/iOS/PyEnvironment.Project.IDE.Deploy.iOSDevice64.pas index e2c33b9..1853252 100644 --- a/src/Project/IDE/Deploy/iOS/PyEnvironment.Project.IDE.Deploy.iOSDevice64.pas +++ b/src/Project/IDE/Deploy/iOS/PyEnvironment.Project.IDE.Deploy.iOSDevice64.pas @@ -59,12 +59,13 @@ function TPyEnvironmentProjectDeployIOSDevice64.GetPlatform: TPyEnvironmentProje function TPyEnvironmentProjectDeployIOSDevice64.GetPythonBundleName: string; begin - case IndexStr(GetPythonVersion(), ['3.8', '3.9', '3.10', '3.11', '3.12']) of + case IndexStr(GetPythonVersion(), ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']) of 0: Result := 'python3-ios-3.8.18-iphoneos.arm64.zip'; 1: Result := 'python3-ios-3.9.18-iphoneos.arm64.zip'; 2: Result := 'python3-ios-3.10.13-iphoneos.arm64.zip'; 3: Result := 'python3-ios-3.11.6-iphoneos.arm64.zip'; 4: Result := 'python3-ios-3.12.0-iphoneos.arm64.zip'; + 5: Result := 'python3-ios-3.13.0-iphoneos.arm64.zip'; else Result := String.Empty; end; diff --git a/src/Project/IDE/Deploy/iOS/PyEnvironment.Project.IDE.Deploy.iOSSimARM64.pas b/src/Project/IDE/Deploy/iOS/PyEnvironment.Project.IDE.Deploy.iOSSimARM64.pas index 0225e4b..028b6a8 100644 --- a/src/Project/IDE/Deploy/iOS/PyEnvironment.Project.IDE.Deploy.iOSSimARM64.pas +++ b/src/Project/IDE/Deploy/iOS/PyEnvironment.Project.IDE.Deploy.iOSSimARM64.pas @@ -59,12 +59,13 @@ function TPyEnvironmentProjectDeployIOSSimARM64.GetPlatform: TPyEnvironmentProje function TPyEnvironmentProjectDeployIOSSimARM64.GetPythonBundleName: string; begin - case IndexStr(GetPythonVersion(), ['3.8', '3.9', '3.10', '3.11', '3.12']) of + case IndexStr(GetPythonVersion(), ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']) of 0: Result := 'python3-ios-3.8.18-iphonesimulator.arm64.zip'; 1: Result := 'python3-ios-3.9.18-iphonesimulator.arm64.zip'; 2: Result := 'python3-ios-3.10.13-iphonesimulator.arm64.zip'; 3: Result := 'python3-ios-3.11.6-iphonesimulator.arm64.zip'; 4: Result := 'python3-ios-3.12.0-iphonesimulator.arm64.zip'; + 5: Result := 'python3-ios-3.13.0-iphonesimulator.arm64.zip'; else Result := String.Empty; end; From 591f664749e8747f77720df3442bee9ba4570420 Mon Sep 17 00:00:00 2001 From: Lucas Moura Belo Date: Tue, 19 Nov 2024 08:08:44 -0300 Subject: [PATCH 2/2] Update README.md --- README.md | 63 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 47 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index a18ef68..a97bbaf 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,58 @@ -

- -

PythonEnvironments

-
-
- MIT License - Discord -

-
+# 🐍 PythonEnvironments for Delphi πŸš€ -After more than two decades of introducing [Python4Delphi (P4D)](https://github.com/Embarcadero/Python4Delphi)), 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 +MIT License +Discord + -**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. +Welcome to **PythonEnvironments**, a project designed to revolutionize the way Delphi developers integrate Python into their applications! -Please check out the [samples](https://github.com/Embarcadero/PythonEnviroments/tree/main/samples) section to Get Started on **PythonEnvironments**. +πŸ”— **Why PythonEnvironments?** +After more than two decades of introducing [Python4Delphi (P4D)](https://github.com/Embarcadero/Python4Delphi), we aim to solve the core challenge that inspired the P4D project in the first place. While P4D made it possible to use Python as a scripting engine for Delphi, its integration process was not always straightforward for the community. -Currently we're providing support for Python versions - `3.8`, `3.9`, `3.10`, `3.11` and `3.12`. +**PythonEnvironments** changes that by providing: +✨ **Design-time components** to seamlessly embed Python environments into your Delphi applications. +✨ Support for the readily-available Python embeddable package. +✨ A smoother, hassle-free experience for developers! +--- +## 🌟 Key Features -https://github.com/Embarcadero/PythonEnvironments/assets/8376898/2073c4ec-04cc-4baf-a703-da91c6af1494 +βœ”οΈ **Simple Integration**: Embed Python effortlessly into your Delphi applications. +βœ”οΈ **Multi-Version Support**: Compatible with Python `3.8`, `3.9`, `3.10`, `3.11`, `3.12`, and `3.13`. +βœ”οΈ **Powered by Python4Delphi**: Leverages the robust capabilities of [P4D](https://github.com/Embarcadero/Python4Delphi). +βœ”οΈ **Extends Python Ecosystem**: Use it with the [P4D Data Sciences Libraries](https://github.com/Embarcadero/P4D-Data-Sciences). +--- +## πŸš€ Getting Started -It is powered by [(P4D)](https://github.com/Embarcadero/Python4Delphi). It powers the [P4D Data Sciences Libraries](https://github.com/Embarcadero/P4D-Data-Sciences). +Head over to the [**Samples Section**](https://github.com/Embarcadero/PythonEnviroments/tree/main/samples) to explore how to get started with **PythonEnvironments** today. -We encourage you to try it out, file bug reports, and add features. [Read more](https://blogs.embarcadero.com/?p=145025) and catch the recorded live stream. +Want to dive deeper? Check out our [blog post](https://blogs.embarcadero.com/?p=145025) or watch the **recorded live stream** to see it in action. + +🎬 **Demo Preview**: + +![PythonEnvironments Demo](https://github.com/Embarcadero/PythonEnvironments/assets/8376898/2073c4ec-04cc-4baf-a703-da91c6af1494) + +--- + +## πŸ“£ Join the Community + +We encourage you to: +- Try out **PythonEnvironments** in your Delphi projects. +- ⭐ **Star this repository** if you find it useful! +- 🐞 [File bug reports](https://github.com/Embarcadero/PythonEnvironments/issues) or suggest new features. +- πŸ”§ Contribute to the project to make it even better. + +--- + +## πŸ”— Resources + +πŸ“˜ [Official Blog Post](https://blogs.embarcadero.com/?p=145025) +πŸ“‚ [Samples and Tutorials](https://github.com/Embarcadero/PythonEnviroments/tree/main/samples) +πŸ“– [P4D Documentation](https://github.com/Embarcadero/Python4Delphi) + +--- + +Let’s make Python integration in Delphi simpler, faster, and more accessible than ever. πŸš€