Skip to content

Commit 2702b50

Browse files
CLI improvements (#41)
* Update package_command.dart * Bump http dep to 1.1.2 and other dependencies * Added `--mobile` and `--verbose` flags. More detailed output. Async everything. * Bump Flet dep to 0.15.0 * Bump serious_python version to 0.6.0 * Create _posixsubprocess.py * More mobile junk files: .a, .pdb, .pyd, .exe, .dll * Delete files with .h extension * Added to readme about `--mobile` and `--verbose` flags * Added --web arg to package for pyodide * FFI things moved to android package * Added extra packaging args * Added web platform to flet_example * Implemented dep-mappings and req-deps arguments * --find-links and --platform implemented * Changelogs updated * Cleanup. * Fix yaml * Use "=" in dep mappings * Fixed flet_example windows project * Use predefined TCP port on Windows to avoid firewall dialog
1 parent 0f7b5cb commit 2702b50

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+782
-212
lines changed

.appveyor.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ for:
195195

196196
test_script:
197197
- cd src/serious_python/example/flet_example
198-
- dart run serious_python:main package app/src --pre
198+
- dart run serious_python:main package app/src --dep-mappings "flet=flet-embed" --req-deps "flet-embed"
199199
- flutter test integration_test -d macos
200200

201201
# ======================================
@@ -234,7 +234,7 @@ for:
234234

235235
test_script:
236236
- cd src/serious_python/example/flet_example
237-
- dart run serious_python:main package app/src --pre
237+
- dart run serious_python:main package app/src --mobile --dep-mappings "flet=flet-embed" --req-deps "flet-embed"
238238
- flutter drive --driver=test_driver/integration_test.dart --target=integration_test/app_test.dart
239239

240240
# ======================================
@@ -276,7 +276,7 @@ for:
276276

277277
test_script:
278278
- cd src/serious_python/example/flet_example
279-
- dart run serious_python:main package app/src --pre
279+
- dart run serious_python:main package app/src --mobile --dep-mappings "flet=flet-embed" --req-deps "flet-embed"
280280
- flutter test integration_test -d emulator-5554
281281

282282

@@ -298,7 +298,7 @@ for:
298298

299299
test_script:
300300
- cd src/serious_python/example/flet_example
301-
- dart run serious_python:main package app/src --pre
301+
- dart run serious_python:main package app/src --dep-mappings "flet=flet-embed" --req-deps "flet-embed"
302302
- flutter test integration_test -d windows
303303

304304
# ======================================
@@ -318,7 +318,7 @@ for:
318318

319319
test_script:
320320
- cd src/serious_python/example/flet_example
321-
- dart run serious_python:main package app/src --pre
321+
- dart run serious_python:main package app/src --dep-mappings "flet=flet-embed" --req-deps "flet-embed"
322322
- xvfb-run flutter test integration_test -d linux
323323

324324
# ======================================
@@ -342,7 +342,7 @@ for:
342342

343343
test_script:
344344
- cd src/serious_python/example/flet_example
345-
- dart run serious_python:main package app/src --pre
345+
- dart run serious_python:main package app/src --dep-mappings "flet=flet-embed" --req-deps "flet-embed"
346346
- xvfb-run flutter test integration_test -d linux
347347

348348
# =========================================

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,15 @@ To simplify the packaging of your Python app Serious Python provides a CLI which
8181
dart run serious_python:main
8282
```
8383

84-
There is `package` command which takes a directory with Python app as the first argument. The command must be run in Flutter app root directory, where `pubspec.yaml` is located. The path could be either relative or an absolute:
84+
There is `package` command which takes a directory with Python app as the first argument. The command must be run in Flutter app root directory, where `pubspec.yaml` is located. The path could be either relative or an absolute.
85+
86+
To package Python files for a mobile app run:
87+
88+
```
89+
dart run serious_python:main package app/src --mobile
90+
```
91+
92+
To package for a desktop app run:
8593

8694
```
8795
dart run serious_python:main package app/src
@@ -285,6 +293,16 @@ List libraries and their versions in `requirements.txt` in the root of your Pyth
285293

286294
List libraries and their versions in `requirements.txt` in the root of your Python app directory.
287295

296+
## Troubleshooting
297+
298+
### Detailed logging
299+
300+
Use `--verbose` flag to enabled detailed logging:
301+
302+
```
303+
dart run serious_python:main package app/src --mobile --verbose
304+
```
305+
288306
## Examples
289307

290308
[Python REPL with Flask backend](src/serious_python/example/flask_example).

src/serious_python/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## 0.6.0
2+
3+
* `--verbose` flag - verbose output.
4+
* `--mobile` flag - (removes `.so`) from app dest archive.
5+
* `--web` flag for packaging for pyodide.
6+
* `--find-links` option for installing pip dependencies from alternative sources (indexes).
7+
* `--dep-mappings` for rewriting `flet` dependency to either `flet-embed` or `flet-pyodide`.
8+
* `--req-deps` for adding required dependencies like `flet-embed` or `flet-pyodide`.
9+
* `--platform` option for use with `sitecustomize.py` to tweak pip to pull platform-specific packages.
10+
* More structured regular output.
11+
* Bump deps versions.
12+
113
## 0.5.1
214

315
* Simplified Python initialization on Android.

src/serious_python/bin/README.rd

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
pip commands:
2+
3+
```
4+
python -m pip install --upgrade --target 2 --no-index --find-links file:///path/to/index.html micropip --verbose
5+
```
6+
7+
`index.html` example:
8+
9+
```html
10+
<a href="https://cdn.jsdelivr.net/pyodide/v0.24.1/full/micropip-0.5.0-py3-none-any.whl">micropip-0.5.0-py3-none-any.whl</a>
11+
<a href="https://cdn.jsdelivr.net/pyodide/v0.24.1/full/packaging-23.1-py3-none-any.whl">packaging-23.1-py3-none-any.whl</a>
12+
<a href="https://cdn.jsdelivr.net/pyodide/v0.24.1/full/numpy-1.25.2-cp311-cp311-emscripten_3_1_45_wasm32.whl">numpy-1.25.2-cp311-cp311-emscripten_3_1_45_wasm32.whl</a>
13+
```

0 commit comments

Comments
 (0)