Skip to content
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
4 changes: 4 additions & 0 deletions src/serious_python/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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))
Expand Down
2 changes: 1 addition & 1 deletion src/serious_python/example/run_example/app/app.zip.hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
067c62c8ae15e77a6935577d0a9cbc8a1b4852f7fc9c458be38d15224e992c9a
86fcefd284f101b084bfb8b72d9eebe97d65c880b1dc97a9b8719ed40c4a3e24
68 changes: 59 additions & 9 deletions src/serious_python/example/run_example/app/src/main.py
Original file line number Diff line number Diff line change
@@ -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!")
Expand Down Expand Up @@ -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)
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
numpy
#numpy
lru-dict
12 changes: 6 additions & 6 deletions src/serious_python/example/run_example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/serious_python/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions src/serious_python_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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))
Expand Down
38 changes: 26 additions & 12 deletions src/serious_python_android/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group 'com.flet.serious_python_android'
version '0.8.1'
version '0.8.2'

def python_version = '3.12'

Expand Down Expand Up @@ -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"
Expand All @@ -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"
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/serious_python_android/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions src/serious_python_darwin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/serious_python_darwin/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions src/serious_python_linux/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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))
Expand Down
2 changes: 1 addition & 1 deletion src/serious_python_linux/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 4 additions & 0 deletions src/serious_python_platform_interface/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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))
Expand Down
2 changes: 1 addition & 1 deletion src/serious_python_platform_interface/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions src/serious_python_windows/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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))
Expand Down
2 changes: 1 addition & 1 deletion src/serious_python_windows/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down