diff --git a/src/serious_python/CHANGELOG.md b/src/serious_python/CHANGELOG.md index 70775813..8d222075 100644 --- a/src/serious_python/CHANGELOG.md +++ b/src/serious_python/CHANGELOG.md @@ -1,3 +1,7 @@ +## 5.0.0 + +* **Breaking (`package` command):** `--exclude`, `--cleanup-app-files` and `--cleanup-package-files` no longer split their values on commas, so paths containing `,` and brace globs such as `**/{tests,docs}` can be passed. Previously a hidden file named `.a,main.py` passed to `--exclude` became two exclusions, dropping `main.py`, and `**/{tests,docs}` was split into two broken globs. Pass each value as its own option: `--exclude build --exclude tests` instead of `--exclude build,tests`. A comma-separated value is now matched as a single path, so an unmigrated command packages the files it used to exclude without failing. The Dart API and runtime are unchanged. `flet build` pins serious_python exactly, so existing Flet releases are unaffected ([#253](https://github.com/flet-dev/serious-python/pull/253), [flet#6839](https://github.com/flet-dev/flet/issues/6839)). + ## 4.7.2 * **Packaging:** report packaging exceptions on stderr and exit with status `1`, so CI and `flet build` stop on failure while temporary files are still cleaned up ([#252](https://github.com/flet-dev/serious-python/pull/252)). diff --git a/src/serious_python/README.md b/src/serious_python/README.md index 95e661cc..24d89952 100644 --- a/src/serious_python/README.md +++ b/src/serious_python/README.md @@ -214,6 +214,24 @@ identifiers assigned upstream. serious_python stages those byte-for-byte and nev rewrites anything inside them — see [SDK-origin signatures](#sdk-origin-signatures) below. +#### Excluding and cleaning up files + +Exclude files and directories from the app package with `--exclude`. Each value is a path relative to the app directory, matched exactly (no globs); a matching directory is excluded with everything in it. Pass the option once per path: + +``` +dart run serious_python:main package app/src -p Darwin \ + --exclude build --exclude tests --exclude src/.venv +``` + +`--cleanup-app` and `--cleanup-packages` (or `--cleanup` for both) delete known junk files (C sources and headers, type stubs, `__pycache__`, and so on) from the app and from the installed packages. Add your own globs with `--cleanup-app-files` and `--cleanup-package-files`, once per glob; they are only applied together with the matching cleanup flag: + +``` +dart run serious_python:main package app/src -p Android --cleanup-packages \ + --cleanup-package-files '**/{tests,docs}' --cleanup-package-files '**.md' +``` + +> `--exclude`, `--cleanup-app-files` and `--cleanup-package-files` stopped splitting their values on commas in **5.0.0**, so paths containing `,` and brace globs such as `**/{tests,docs}` can be expressed. The comma-separated form (`--exclude build,tests`) now matches a single path named `build,tests`; pass each value as its own option instead. + ## Python app structure By default, embedded Python program is run in a separate thread, to avoid UI blocking. Your Flutter app is not supposed to directly call Python functions or modules, but instead it should communicate via some API provided by a Python app, such as: REST API, sockets, SQLite database, files, etc. @@ -256,7 +274,7 @@ The on-disk layout differs per platform, mostly because each OS has different ru ### Your app program (all platforms) -`package` copies your Python sources into a temp dir (honoring `--exclude` globs, optionally compiling to `.pyc` with `--compile-app`). For **native** platforms it stages them to `SERIOUS_PYTHON_APP`, and the platform build drops them **unpacked into the bundle** next to the stdlib/site-packages — `/app` (iOS/macOS), `/app` (Windows/Linux). There's no first-launch extraction; `SeriousPython.prepareApp()` just returns that path. On **Android** the sources are zipped into a *stored* `app.zip` asset and unpacked once (version-keyed by your app version) to `/flet/app` on the first launch after an install/update. On the **web** they're zipped into `app/app.zip` and loaded by Pyodide. Your app dir is placed first on `sys.path`; a sibling `__pypackages__/` is also added (so you can vendor pure-Python deps next to your code). At run time the current directory is set to a writable `/data` (the app dir itself is read-only). +`package` copies your Python sources into a temp dir (skipping `--exclude` paths, optionally compiling to `.pyc` with `--compile-app`). For **native** platforms it stages them to `SERIOUS_PYTHON_APP`, and the platform build drops them **unpacked into the bundle** next to the stdlib/site-packages — `/app` (iOS/macOS), `/app` (Windows/Linux). There's no first-launch extraction; `SeriousPython.prepareApp()` just returns that path. On **Android** the sources are zipped into a *stored* `app.zip` asset and unpacked once (version-keyed by your app version) to `/flet/app` on the first launch after an install/update. On the **web** they're zipped into `app/app.zip` and loaded by Pyodide. Your app dir is placed first on `sys.path`; a sibling `__pypackages__/` is also added (so you can vendor pure-Python deps next to your code). At run time the current directory is set to a writable `/data` (the app dir itself is read-only). `pip install` output goes to `build/site-packages` by default (override with the `SERIOUS_PYTHON_SITE_PACKAGES` env var). For mobile, packages are installed **per architecture** (a `sitecustomize.py` shim spoofs the wheel platform tag so the correct mobile wheels resolve), then merged or split per platform as shown above. diff --git a/src/serious_python/bin/package_command.dart b/src/serious_python/bin/package_command.dart index a55ef8a0..b92442ec 100644 --- a/src/serious_python/bin/package_command.dart +++ b/src/serious_python/bin/package_command.dart @@ -164,7 +164,8 @@ class PackageCommand extends Command { "Output asset path, relative to pubspec.yaml, to package Python program into."); argParser.addMultiOption('exclude', help: - "List of relative paths to exclude from app package, e.g. \"assets,build\"."); + "Relative path to exclude from app package, e.g. \"build\"; can be used multiple times.", + splitCommas: false); argParser.addFlag("skip-site-packages", help: "Skip installation of site packages.", negatable: false); argParser.addFlag("compile-app", @@ -180,12 +181,16 @@ class PackageCommand extends Command { help: "Cleanup app from unneccessary files and directories.", negatable: false); argParser.addMultiOption('cleanup-app-files', - help: "List of globs to delete extra app files and directories."); + help: + "Glob to delete extra app files and directories; can be used multiple times.", + splitCommas: false); argParser.addFlag("cleanup-packages", help: "Cleanup packages from unneccessary files and directories.", negatable: false); argParser.addMultiOption('cleanup-package-files', - help: "List of globs to delete extra packages files and directories."); + help: + "Glob to delete extra packages files and directories; can be used multiple times.", + splitCommas: false); argParser.addFlag("verbose", help: "Verbose output.", negatable: false); } diff --git a/src/serious_python/example/flask_example/pubspec.lock b/src/serious_python/example/flask_example/pubspec.lock index 5a8390a0..b69aa558 100644 --- a/src/serious_python/example/flask_example/pubspec.lock +++ b/src/serious_python/example/flask_example/pubspec.lock @@ -361,42 +361,42 @@ packages: path: "../.." relative: true source: path - version: "4.7.2" + version: "5.0.0" serious_python_android: dependency: transitive description: path: "../../../serious_python_android" relative: true source: path - version: "4.7.2" + version: "5.0.0" serious_python_darwin: dependency: transitive description: path: "../../../serious_python_darwin" relative: true source: path - version: "4.7.2" + version: "5.0.0" serious_python_linux: dependency: transitive description: path: "../../../serious_python_linux" relative: true source: path - version: "4.7.2" + version: "5.0.0" serious_python_platform_interface: dependency: transitive description: path: "../../../serious_python_platform_interface" relative: true source: path - version: "4.7.2" + version: "5.0.0" serious_python_windows: dependency: transitive description: path: "../../../serious_python_windows" relative: true source: path - version: "4.7.2" + version: "5.0.0" shelf: dependency: transitive description: diff --git a/src/serious_python/example/run_example/pubspec.lock b/src/serious_python/example/run_example/pubspec.lock index 98bf80dd..7ce9a98a 100644 --- a/src/serious_python/example/run_example/pubspec.lock +++ b/src/serious_python/example/run_example/pubspec.lock @@ -384,42 +384,42 @@ packages: path: "../.." relative: true source: path - version: "4.7.2" + version: "5.0.0" serious_python_android: dependency: transitive description: path: "../../../serious_python_android" relative: true source: path - version: "4.7.2" + version: "5.0.0" serious_python_darwin: dependency: transitive description: path: "../../../serious_python_darwin" relative: true source: path - version: "4.7.2" + version: "5.0.0" serious_python_linux: dependency: transitive description: path: "../../../serious_python_linux" relative: true source: path - version: "4.7.2" + version: "5.0.0" serious_python_platform_interface: dependency: transitive description: path: "../../../serious_python_platform_interface" relative: true source: path - version: "4.7.2" + version: "5.0.0" serious_python_windows: dependency: transitive description: path: "../../../serious_python_windows" relative: true source: path - version: "4.7.2" + version: "5.0.0" shelf: dependency: transitive description: diff --git a/src/serious_python/pubspec.yaml b/src/serious_python/pubspec.yaml index c42cca47..65555baf 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: 4.7.2 +version: 5.0.0 platforms: ios: diff --git a/src/serious_python_android/CHANGELOG.md b/src/serious_python_android/CHANGELOG.md index cf75b76f..59a1a227 100644 --- a/src/serious_python_android/CHANGELOG.md +++ b/src/serious_python_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 5.0.0 + +* Align with the serious_python **5.0.0** release ([#253](https://github.com/flet-dev/serious-python/pull/253)). + ## 4.7.2 * Align with the serious_python **4.7.2** release ([#252](https://github.com/flet-dev/serious-python/pull/252)). diff --git a/src/serious_python_android/android/build.gradle.kts b/src/serious_python_android/android/build.gradle.kts index 95f6b674..c8ebdbc3 100644 --- a/src/serious_python_android/android/build.gradle.kts +++ b/src/serious_python_android/android/build.gradle.kts @@ -21,7 +21,7 @@ buildscript { } group = "com.flet.serious_python_android" -version = "4.7.2" +version = "5.0.0" rootProject.allprojects { repositories { diff --git a/src/serious_python_android/pubspec.yaml b/src/serious_python_android/pubspec.yaml index c0e90b0c..63b170a5 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: 4.7.2 +version: 5.0.0 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 a9ba1ce1..34e8150d 100644 --- a/src/serious_python_darwin/CHANGELOG.md +++ b/src/serious_python_darwin/CHANGELOG.md @@ -1,3 +1,7 @@ +## 5.0.0 + +* Align with the serious_python **5.0.0** release ([#253](https://github.com/flet-dev/serious-python/pull/253)). + ## 4.7.2 * **macOS:** fix App Store Connect error `90238` ("does not satisfy its designated Requirement") caused by linker-signed native modules ([#250](https://github.com/flet-dev/serious-python/issues/250), [#251](https://github.com/flet-dev/serious-python/pull/251)). Staging now replaces linker signatures on `.so` and `.dylib` files in the stdlib, site-packages and app with regular ad-hoc signatures. This preserves their signing identifiers when Xcode re-signs them for distribution, avoiding a mismatch with their designated requirements. diff --git a/src/serious_python_darwin/darwin/serious_python_darwin.podspec b/src/serious_python_darwin/darwin/serious_python_darwin.podspec index 00bcf761..da45c3d9 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 = '4.7.2' + s.version = '5.0.0' 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 6fd95b67..ad781b43 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: 4.7.2 +version: 5.0.0 environment: # The Swift Package Manager build path needs Flutter 3.44 / Dart 3.11 (the diff --git a/src/serious_python_linux/CHANGELOG.md b/src/serious_python_linux/CHANGELOG.md index f4dd8a28..5f92c2bd 100644 --- a/src/serious_python_linux/CHANGELOG.md +++ b/src/serious_python_linux/CHANGELOG.md @@ -1,3 +1,7 @@ +## 5.0.0 + +* Align with the serious_python **5.0.0** release ([#253](https://github.com/flet-dev/serious-python/pull/253)). + ## 4.7.2 * Align with the serious_python **4.7.2** release ([#252](https://github.com/flet-dev/serious-python/pull/252)). diff --git a/src/serious_python_linux/pubspec.yaml b/src/serious_python_linux/pubspec.yaml index 0d90986b..16d5446e 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: 4.7.2 +version: 5.0.0 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 29f16a25..146c5cc6 100644 --- a/src/serious_python_platform_interface/CHANGELOG.md +++ b/src/serious_python_platform_interface/CHANGELOG.md @@ -1,3 +1,7 @@ +## 5.0.0 + +* Align with the serious_python **5.0.0** release ([#253](https://github.com/flet-dev/serious-python/pull/253)). + ## 4.7.2 * Align with the serious_python **4.7.2** release ([#252](https://github.com/flet-dev/serious-python/pull/252)). diff --git a/src/serious_python_platform_interface/pubspec.yaml b/src/serious_python_platform_interface/pubspec.yaml index 0d5d15f4..70076c69 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: 4.7.2 +version: 5.0.0 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 26bf6d36..6a203d54 100644 --- a/src/serious_python_windows/CHANGELOG.md +++ b/src/serious_python_windows/CHANGELOG.md @@ -1,3 +1,7 @@ +## 5.0.0 + +* Align with the serious_python **5.0.0** release ([#253](https://github.com/flet-dev/serious-python/pull/253)). + ## 4.7.2 * Align with the serious_python **4.7.2** release ([#252](https://github.com/flet-dev/serious-python/pull/252)). diff --git a/src/serious_python_windows/pubspec.yaml b/src/serious_python_windows/pubspec.yaml index cf7536b1..f592d4c6 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: 4.7.2 +version: 5.0.0 environment: sdk: '>=3.1.3 <4.0.0'