mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-23 22:00:25 -05:00
Move tests, create makefile action to run tests on examples (#433)
* Move tests, create makefile action to run tests on examples * Correct import file for html files * Build environment for tests * Fix the CI * rearrange CI * fix find cmd and make sure we don't delete the folder implicitly * more rearranging * fix folder permissions and custom sed for subfolders * add toga wheels files * re-add missing file * mirror latest changes in alpha ci * fix find cmd * try different fix for find * remove redundant build Co-authored-by: mariana <marianameireles@protonmail.com> Co-authored-by: pww217 <pwilson@anaconda.com> Co-authored-by: Fabio Pliger <fabio.pliger@gmail.com>
This commit is contained in:
79
examples/toga/README.md
Normal file
79
examples/toga/README.md
Normal file
@@ -0,0 +1,79 @@
|
||||
# Freedom Units!
|
||||
|
||||
This is a demo Toga app implementing a Fahrenheit to Celsius converter.
|
||||
|
||||
## Initial setup
|
||||
|
||||
1. Create and activate a virtual environment:
|
||||
|
||||
$ python -m venv venv
|
||||
$ . ./venv/bin/activate
|
||||
|
||||
2. Install the demo requirements:
|
||||
|
||||
$ pip install -r requirements.txt
|
||||
|
||||
### Development details
|
||||
|
||||
This demo symbolically links the pyscript build generated by the npm server
|
||||
(`../build`) into the `./static/pyscript` directory. This symbolic link should
|
||||
be restored automatically by git. This also means you'll need to run the main
|
||||
pyscript demos at least once before running the server-rendered version of the
|
||||
app. If you experience problems loading pyscript, check whether this link
|
||||
exists, and the `build/pyscript.js` file has been compiled.
|
||||
|
||||
It also includes an vendored experimental version of toga-core, toga-web and
|
||||
toga-flask, packaged as wheels in the `./static/wheels` directory. If any changes
|
||||
are made to the Toga sources, these vendored resources will need to be updated.
|
||||
|
||||
## Web app
|
||||
|
||||
This app can be viewed as a Single Page App (SPA); this version of the app is
|
||||
linked from the main PyScript demo pages.
|
||||
|
||||
It can also be viewed as a server-rendered app. This version of the app is
|
||||
delivered by a demo Flask server, serving a version of app at the root URL. To
|
||||
run the web demo server:
|
||||
|
||||
$ cd server
|
||||
$ PYTHONPATH=../freedom/src python -m demo
|
||||
|
||||
then point your browser at http://localhost:8081/
|
||||
|
||||
Enter a value in the "Fahrenheit" input, and click the "calculate" button.
|
||||
|
||||
It may take a few seconds for this button to become live; look for the
|
||||
"Collecting nodes..." entry in the console log.
|
||||
|
||||
## Desktop app
|
||||
|
||||
To run this app in development mode:
|
||||
|
||||
$ briefcase dev
|
||||
|
||||
To build and run an app bundle:
|
||||
|
||||
$ briefcase run
|
||||
|
||||
If you're on an M1 macOS, this will raise an error on first run; if you get this error, run:
|
||||
|
||||
$ briefcase package -p app --adhoc-sign
|
||||
|
||||
then re-run `briefcase run`
|
||||
|
||||
## iOS app
|
||||
|
||||
To run this in the iOS simulator, run:
|
||||
|
||||
$ briefcase run iOS
|
||||
|
||||
To run this in the Android simulator, run:
|
||||
|
||||
$ briefcase run android
|
||||
|
||||
Note that these builds have extensive requirements that must be installed -
|
||||
Xcode for iOS, and the Android SDKs for Android. These are multiple gigabyte
|
||||
downloads. Briefcase will detect when these tools aren't available, and either
|
||||
prompt you to download them, or perform a download for you. As a result, your
|
||||
first build may take up to 20 minutes to complete, depending on the speed of
|
||||
your connection.
|
||||
Reference in New Issue
Block a user