You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Small corrections to docs and podspec
* Hide package implementation behind `src`
* Set current dir before running Python program
* Flet example added
* Added `--pre` flag
* Flet example
* Version bump to 0.1.1, added docs, static methods
Copy file name to clipboardExpand all lines: README.md
+9-7Lines changed: 9 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,29 +44,29 @@ platform :ios, '12.0'
44
44
Create an instance of `SeriousPython` class and call its `run()` method:
45
45
46
46
```dart
47
-
SeriousPython().run("app/app.zip");
47
+
SeriousPython.run("app/app.zip");
48
48
```
49
49
50
50
When the app starts the archive is unpacked to a temporary directory and Serious Python plugin will try to run `main.py` in the root of the archive. Current directory is changed to a temporary directory.
51
51
52
52
If your Python app has a different entry point it could be specified with `appFileName` parameter:
You can pass a map with environment variables that should be available in your Python program:
59
59
60
60
```dart
61
-
SeriousPython().run("app/app.zip",
61
+
SeriousPython.run("app/app.zip",
62
62
appFileName: "my_app.py",
63
63
environmentVariables: {"a": "1", "b": "2"});
64
64
```
65
65
66
66
By default, Serious Python expects Python dependencies installed into `__pypackages__` directory in the root of app directory. You can add additional paths to look for 3rd-party packages using `modulePaths` parameter:
@@ -99,9 +99,9 @@ Make sure generated asset is added to `pubspec.yaml`.
99
99
100
100
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.
101
101
102
-
To constantly run on background a Python program must be blocking, for example a [Flask app](examples/flask_example) listening on `8000` port, or you can start your long-running computations in `threading.Thread` and use `threading.Event` to prevent program from exiting.
102
+
To constantly run on background a Python program must be blocking, for example a [Flask app](example/flask_example) listening on `8000` port, or you can start your long-running computations in `threading.Thread` and use `threading.Event` to prevent program from exiting.
103
103
104
-
Synchronous execution of Python program is also supported with `sync: true` parameter to `SeriousPython().run()` method. For example, it could be a utility program doing some preperations, etc. Just make sure it's either very short or run in a Dart isolate to avoid blocking UI.
104
+
Synchronous execution of Python program is also supported with `sync: true` parameter to `SeriousPython.run()` method. For example, it could be a utility program doing some preperations, etc. Just make sure it's either very short or run in a Dart isolate to avoid blocking UI.
105
105
106
106
## Supported Python packages
107
107
@@ -117,7 +117,9 @@ TBD
117
117
118
118
## Examples
119
119
120
-
[Python REPL with Flask backend](examples/flask_example).
120
+
[Python REPL with Flask backend](example/flask_example).
An exampe of using Flask to host app backend API written in Python.
6
+
7
+
[Source](flask_example)
8
+
9
+
### Flet app
10
+
11
+
An example of integrating [Flet widget](https://pub.dev/packages/flet) and [Flet framework](https://pypi.org/project/flet/) to easily create awesome Flutter apps in Python.
0 commit comments