diff --git a/src/serious_python/CHANGELOG.md b/src/serious_python/CHANGELOG.md index dfb89246..bc7cf980 100644 --- a/src/serious_python/CHANGELOG.md +++ b/src/serious_python/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.8.2 + +* Copy `.so` libraries from `{site-packages}/opt` to `jniLibs`. + ## 0.8.1 * Remove `--only-binary` when packaging for desktop platforms ([#112](https://github.com/flet-dev/serious-python/issues/112)) diff --git a/src/serious_python/example/run_example/app/app.zip.hash b/src/serious_python/example/run_example/app/app.zip.hash index 3209af71..e591ecb1 100644 --- a/src/serious_python/example/run_example/app/app.zip.hash +++ b/src/serious_python/example/run_example/app/app.zip.hash @@ -1 +1 @@ -067c62c8ae15e77a6935577d0a9cbc8a1b4852f7fc9c458be38d15224e992c9a \ No newline at end of file +86fcefd284f101b084bfb8b72d9eebe97d65c880b1dc97a9b8719ed40c4a3e24 \ No newline at end of file diff --git a/src/serious_python/example/run_example/app/src/main.py b/src/serious_python/example/run_example/app/src/main.py index d93267b5..d7f346e7 100644 --- a/src/serious_python/example/run_example/app/src/main.py +++ b/src/serious_python/example/run_example/app/src/main.py @@ -1,10 +1,10 @@ print("Hello from Python program!") +import _imp import os +from pathlib import Path from time import sleep -import _imp - _imp.extension_suffixes() print("HELLO!") @@ -73,21 +73,71 @@ def test_numpy_performance(): assert duration < 0.7 -test_lru() -test_numpy_basic() -test_numpy_performance() - -# result_value = str(_imp.extension_suffixes()) -# result_value = decompressed.decode("utf8") - if not result_filename: print("RESULT_FILENAME is not set") exit(1) +r = "" if result_value: r = result_value else: r = "RESULT_VALUE is not set" + +def test_sqlite(): + try: + import ctypes + + ctypes.cdll.LoadLibrary("libsqlite3_python.so") + import sqlite3 + + out_dir = Path(result_filename).parent + conn = sqlite3.connect(str(out_dir.joinpath("mydb.db"))) + + conn.execute("""CREATE TABLE COMPANY + (ID INT PRIMARY KEY NOT NULL, + NAME TEXT NOT NULL, + AGE INT NOT NULL, + ADDRESS CHAR(50), + SALARY REAL);""") + + conn.execute( + "INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY) \ + VALUES (1, 'Paul', 32, 'California', 20000.00 )" + ) + + conn.execute( + "INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY) \ + VALUES (2, 'Allen', 25, 'Texas', 15000.00 )" + ) + + conn.execute( + "INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY) \ + VALUES (3, 'Teddy', 23, 'Norway', 20000.00 )" + ) + + conn.execute( + "INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY) \ + VALUES (4, 'Mark', 25, 'Rich-Mond ', 65000.00 )" + ) + + conn.commit() + print("Records created successfully") + + conn.close() + + return "\nsqlite: test_basic - OK" + except Exception as e: + return f"\nsqlite: test_basic - error: {e}" + + +r += test_sqlite() +# test_lru() +# test_numpy_basic() +# test_numpy_performance() + +# result_value = str(_imp.extension_suffixes()) +# result_value = decompressed.decode("utf8") + with open(result_filename, "w") as f: f.write(r) diff --git a/src/serious_python/example/run_example/app/src/requirements.txt b/src/serious_python/example/run_example/app/src/requirements.txt index 8cb386d2..6845f10b 100644 --- a/src/serious_python/example/run_example/app/src/requirements.txt +++ b/src/serious_python/example/run_example/app/src/requirements.txt @@ -1,2 +1,2 @@ -numpy +#numpy lru-dict \ No newline at end of file diff --git a/src/serious_python/example/run_example/pubspec.lock b/src/serious_python/example/run_example/pubspec.lock index 6c3a690e..6d61a8fa 100644 --- a/src/serious_python/example/run_example/pubspec.lock +++ b/src/serious_python/example/run_example/pubspec.lock @@ -296,42 +296,42 @@ packages: path: "../.." relative: true source: path - version: "0.8.0" + version: "0.8.1" serious_python_android: dependency: transitive description: path: "../../../serious_python_android" relative: true source: path - version: "0.8.0" + version: "0.8.1" serious_python_darwin: dependency: transitive description: path: "../../../serious_python_darwin" relative: true source: path - version: "0.8.0" + version: "0.8.1" serious_python_linux: dependency: transitive description: path: "../../../serious_python_linux" relative: true source: path - version: "0.8.0" + version: "0.8.1" serious_python_platform_interface: dependency: transitive description: path: "../../../serious_python_platform_interface" relative: true source: path - version: "0.8.0" + version: "0.8.1" serious_python_windows: dependency: transitive description: path: "../../../serious_python_windows" relative: true source: path - version: "0.8.0" + version: "0.8.1" shelf: dependency: transitive description: diff --git a/src/serious_python/pubspec.yaml b/src/serious_python/pubspec.yaml index 353b7caf..3a95eed4 100644 --- a/src/serious_python/pubspec.yaml +++ b/src/serious_python/pubspec.yaml @@ -2,7 +2,7 @@ name: serious_python description: A cross-platform plugin for adding embedded Python runtime to your Flutter apps. homepage: https://flet.dev repository: https://github.com/flet-dev/serious-python -version: 0.8.1 +version: 0.8.2 platforms: ios: diff --git a/src/serious_python_android/CHANGELOG.md b/src/serious_python_android/CHANGELOG.md index a263e40b..3a0e794f 100644 --- a/src/serious_python_android/CHANGELOG.md +++ b/src/serious_python_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.8.2 + +* Copy `.so` libraries from `{site-packages}/opt` to `jniLibs`. + ## 0.8.1 * Remove `--only-binary` when packaging for desktop platforms ([#112](https://github.com/flet-dev/serious-python/issues/112)) diff --git a/src/serious_python_android/android/build.gradle b/src/serious_python_android/android/build.gradle index 3eb12adc..2f57c85b 100644 --- a/src/serious_python_android/android/build.gradle +++ b/src/serious_python_android/android/build.gradle @@ -1,5 +1,5 @@ group 'com.flet.serious_python_android' -version '0.8.1' +version '0.8.2' def python_version = '3.12' @@ -82,7 +82,18 @@ task copyBuildDist(type: Copy) { // Loop through abiFilters def packageTasks = [] android.defaultConfig.ndk.abiFilters.each { abi -> + + def srcDir = System.getenv('SERIOUS_PYTHON_SITE_PACKAGES') + if (srcDir == null || srcDir.allWhitespace) { + throw new InvalidUserDataException("SERIOUS_PYTHON_SITE_PACKAGES environment variable is not set.") + } + packageTasks.add("zipSitePackages_$abi") + packageTasks.add("copyOpt_$abi") + + tasks.register("jniCleanUp_$abi", Delete) { + delete "src/main/jniLibs/$abi" + } tasks.register("downloadDistArchive_$abi", Download) { src "https://github.com/flet-dev/python-build/releases/download/v${python_version}/python-android-dart-${python_version}-${abi}.tar.gz" @@ -91,21 +102,24 @@ android.defaultConfig.ndk.abiFilters.each { abi -> tasks.register("untarFile_$abi", Copy) { from tarTree(tasks.named("downloadDistArchive_$abi").get().dest) into "src/main/jniLibs/$abi" - } - tasks.named("untarFile_$abi") { - dependsOn "downloadDistArchive_$abi" + dependsOn "jniCleanUp_$abi", "downloadDistArchive_$abi" } - tasks.register("zipSitePackages_$abi", Zip) { - def srcDir = System.getenv('SERIOUS_PYTHON_SITE_PACKAGES') - if (srcDir != null) { - from fileTree(dir: "$srcDir/$abi") - archiveFileName = "libpythonsitepackages.so" - destinationDirectory = file("src/main/jniLibs/$abi") + tasks.register("copyOpt_$abi", Copy) { + from fileTree(dir: "$srcDir/$abi/opt", include: ["**/*.so"]) + into "src/main/jniLibs/$abi" + eachFile { + path = name } + includeEmptyDirs = false + dependsOn "jniCleanUp_$abi" } - tasks.named("zipSitePackages_$abi") { - dependsOn "untarFile_$abi" + + tasks.register("zipSitePackages_$abi", Zip) { + from fileTree(dir: "$srcDir/$abi", exclude: ["opt"]) + archiveFileName = "libpythonsitepackages.so" + destinationDirectory = file("src/main/jniLibs/$abi") + dependsOn "jniCleanUp_$abi", "untarFile_$abi" } } diff --git a/src/serious_python_android/pubspec.yaml b/src/serious_python_android/pubspec.yaml index 897b39f1..9c20df4f 100644 --- a/src/serious_python_android/pubspec.yaml +++ b/src/serious_python_android/pubspec.yaml @@ -2,7 +2,7 @@ name: serious_python_android description: Android implementation of the serious_python plugin homepage: https://flet.dev repository: https://github.com/flet-dev/serious-python -version: 0.8.1 +version: 0.8.2 environment: sdk: ">=3.0.0 <4.0.0" diff --git a/src/serious_python_darwin/CHANGELOG.md b/src/serious_python_darwin/CHANGELOG.md index 936d9f09..0f4419af 100644 --- a/src/serious_python_darwin/CHANGELOG.md +++ b/src/serious_python_darwin/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.8.2 + +* Copy `.so` libraries from `{site-packages}/opt` to `jniLibs`. + ## 0.8.1 * Remove `--only-binary` when packaging for desktop platforms ([#112](https://github.com/flet-dev/serious-python/issues/112)) diff --git a/src/serious_python_darwin/darwin/serious_python_darwin.podspec b/src/serious_python_darwin/darwin/serious_python_darwin.podspec index b8f3720a..e1ded3fd 100644 --- a/src/serious_python_darwin/darwin/serious_python_darwin.podspec +++ b/src/serious_python_darwin/darwin/serious_python_darwin.podspec @@ -4,7 +4,7 @@ # Pod::Spec.new do |s| s.name = 'serious_python_darwin' - s.version = '0.8.1' + s.version = '0.8.2' s.summary = 'A cross-platform plugin for adding embedded Python runtime to your Flutter apps.' s.description = <<-DESC A cross-platform plugin for adding embedded Python runtime to your Flutter apps. diff --git a/src/serious_python_darwin/pubspec.yaml b/src/serious_python_darwin/pubspec.yaml index 69a1eb60..da9a09b8 100644 --- a/src/serious_python_darwin/pubspec.yaml +++ b/src/serious_python_darwin/pubspec.yaml @@ -2,7 +2,7 @@ name: serious_python_darwin description: iOS and macOS implementations of the serious_python plugin homepage: https://flet.dev repository: https://github.com/flet-dev/serious-python -version: 0.8.1 +version: 0.8.2 environment: sdk: ">=3.0.0 <4.0.0" diff --git a/src/serious_python_linux/CHANGELOG.md b/src/serious_python_linux/CHANGELOG.md index 55de4a29..71d26bc8 100644 --- a/src/serious_python_linux/CHANGELOG.md +++ b/src/serious_python_linux/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.8.2 + +* Copy `.so` libraries from `{site-packages}/opt` to `jniLibs`. + ## 0.8.1 * Remove `--only-binary` when packaging for desktop platforms ([#112](https://github.com/flet-dev/serious-python/issues/112)) diff --git a/src/serious_python_linux/pubspec.yaml b/src/serious_python_linux/pubspec.yaml index ff7d4ea4..daf4f4ca 100644 --- a/src/serious_python_linux/pubspec.yaml +++ b/src/serious_python_linux/pubspec.yaml @@ -2,7 +2,7 @@ name: serious_python_linux description: Linux implementations of the serious_python plugin homepage: https://flet.dev repository: https://github.com/flet-dev/serious-python -version: 0.8.1 +version: 0.8.2 environment: sdk: '>=3.1.3 <4.0.0' diff --git a/src/serious_python_platform_interface/CHANGELOG.md b/src/serious_python_platform_interface/CHANGELOG.md index e0772573..b4600280 100644 --- a/src/serious_python_platform_interface/CHANGELOG.md +++ b/src/serious_python_platform_interface/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.8.2 + +* Copy `.so` libraries from `{site-packages}/opt` to `jniLibs`. + ## 0.8.1 * Remove `--only-binary` when packaging for desktop platforms ([#112](https://github.com/flet-dev/serious-python/issues/112)) diff --git a/src/serious_python_platform_interface/pubspec.yaml b/src/serious_python_platform_interface/pubspec.yaml index b510e513..ffe56f39 100644 --- a/src/serious_python_platform_interface/pubspec.yaml +++ b/src/serious_python_platform_interface/pubspec.yaml @@ -2,7 +2,7 @@ name: serious_python_platform_interface description: A common platform interface for the serious_python plugin. homepage: https://flet.dev repository: https://github.com/flet-dev/serious-python -version: 0.8.1 +version: 0.8.2 environment: sdk: ">=3.0.0 <4.0.0" diff --git a/src/serious_python_windows/CHANGELOG.md b/src/serious_python_windows/CHANGELOG.md index d0f2b851..7926cdf1 100644 --- a/src/serious_python_windows/CHANGELOG.md +++ b/src/serious_python_windows/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.8.2 + +* Copy `.so` libraries from `{site-packages}/opt` to `jniLibs`. + ## 0.8.1 * Remove `--only-binary` when packaging for desktop platforms ([#112](https://github.com/flet-dev/serious-python/issues/112)) diff --git a/src/serious_python_windows/pubspec.yaml b/src/serious_python_windows/pubspec.yaml index b8f0c9de..fd4428bf 100644 --- a/src/serious_python_windows/pubspec.yaml +++ b/src/serious_python_windows/pubspec.yaml @@ -2,7 +2,7 @@ name: serious_python_windows description: Windows implementations of the serious_python plugin homepage: https://flet.dev repository: https://github.com/flet-dev/serious-python -version: 0.8.1 +version: 0.8.2 environment: sdk: '>=3.1.3 <4.0.0'