Skip to content

Including Python 3.13 #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 47 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,58 @@
<p align="center">
<a href="https://github.com/Embarcadero/PythonEnviroments/"><img src="https://user-images.githubusercontent.com/17174106/200104132-1df6c0a3-fe9f-418d-bcbc-97d7e66472b5.png"></a>
<h1 align="center"> PythonEnvironments </h1>
<br />
<br />
<a href="http://choosealicense.com/licenses/mit/"><img src="https://img.shields.io/badge/license-MIT-red.svg?style=flat" alt="MIT License" align="center"></a>
<a href="https://discord.gg/YEuCUKtsGe"><img src="https://img.shields.io/discord/989230637342933042?color=yellow&label=discord&logo=discord" alt="Discord" align="center"></a>
</p>
<hr />
# 🐍 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
<a href="http://choosealicense.com/licenses/mit/"><img src="https://img.shields.io/badge/license-MIT-red.svg?style=flat" alt="MIT License" align="center"></a>
<a href="https://discord.gg/YEuCUKtsGe"><img src="https://img.shields.io/discord/989230637342933042?color=yellow&label=discord&logo=discord" alt="Discord" align="center"></a>
<a src="https://github.com/Embarcadero/PythonEnviroments/"><img src="https://user-images.githubusercontent.com/17174106/200104132-1df6c0a3-fe9f-418d-bcbc-97d7e66472b5.png" align="right"></a>

**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. 🚀
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,13 @@ function TPyEnvironmentProjectDeployAndroid.MakeAssetsFromZip: TArray<string>;
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()]));
Expand All @@ -150,7 +156,7 @@ function TPyEnvironmentProjectDeployAndroid.MakeAssetsFromZip: TArray<string>;

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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
(* *)
(* Project page: https://github.com/Embarcadero/PythonEnviroments *)
(**************************************************************************)
(* Functionality: Make deployables for Android *)
(* Functionality: Make deployables for Linux *)
(* *)
(* *)
(**************************************************************************)
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/Project/IDE/Deploy/PyEnvironment.Project.IDE.Deploy.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -318,7 +318,7 @@ class procedure TPyEnvironmentProjectDeploy.GetDeployFilesAsync(
var
LModel: TDeployFilesModel;
begin
TPythonMessage.ShowMessageView(true);
TPythonMessage.ShowMessageView(false);

// Must queue this call
TTask.Run(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
(* *)
(* Project page: https://github.com/Embarcadero/PythonEnviroments *)
(**************************************************************************)
(* Functionality: Make deployables for iOS Device ARM64 *)
(* Functionality: Make deployables for Windows x86 *)
(* *)
(* *)
(**************************************************************************)
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
(* *)
(* Project page: https://github.com/Embarcadero/PythonEnviroments *)
(**************************************************************************)
(* Functionality: Make deployables for iOS Device ARM64 *)
(* Functionality: Make deployables for Windows x64 *)
(* *)
(* *)
(**************************************************************************)
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down