@stlite/desktop 0.21.1 → 0.21.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +50 -0
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1 +1,51 @@
1
1
  # `@stlite/desktop`
2
+
3
+ Convert your [Streamlit](https://streamlit.io/) application into a desktop app with [stlite](https://github.com/whitphx/stlite) runtime, a [Pyodide](https://pyodide.org/)-based Wasm-port of Streamlit.
4
+
5
+ ## How to create a Streamlit desktop app
6
+
7
+ 1. Create the following `package.json` file to start a new NPM project. Edit the `name` field.
8
+ ```json
9
+ {
10
+ "name": "xxx",
11
+ "version": "0.1.0",
12
+ "main": "./build/electron/main.js",
13
+ "scripts": {
14
+ "dump": "dump-stlite-desktop-artifacts",
15
+ "serve": "NODE_ENV=\"production\" electron .",
16
+ "pack": "electron-builder --dir",
17
+ "dist": "electron-builder",
18
+ "postinstall": "electron-builder install-app-deps"
19
+ },
20
+ "build": {
21
+ "files": ["build/**/*"],
22
+ "directories": {
23
+ "buildResources": "assets"
24
+ }
25
+ },
26
+ "devDependencies": {
27
+ "@stlite/desktop": "^0.21.0",
28
+ "electron": "20.2.0",
29
+ "electron-builder": "^23.3.3"
30
+ }
31
+ }
32
+ ```
33
+ 2. Run `npm install` or `yarn install`.
34
+ 3. Create `streamlit_app` directory.
35
+ - Any directory name can be used here.
36
+ 4. Create `streamlit_app/streamlit_app.py`.
37
+ - Change the directory name if you used a different name in the previous step.
38
+ 5. Write your Streamlit app code in `streamlit_app/streamlit_app.py`.
39
+ - The file name `streamlit_app.py` is not configurable now.
40
+ 6. Optionally, you can add more contents in the directory, including `pages/*.py` for multi-page apps, any data files, and so on.
41
+ 7. Run `npm run dump streamlit_app` or `yarn dump streamlit_app`. The command argument `streamlit_app` is the directory name of the Streamlit app you have created in the previous steps. Change it if you used a different name.
42
+ - If installing some packages is needed, pass the package names following the directory name like `npm run dump streamlit_app <PackageName1> ... <PackageNameN>`.
43
+ - The `-r` option like the `pip` command is also available to specify the text files listing the package names to install like `npm run dump streamlit_app -- -r requirements.txt` (NPM) or `yarn dump streamlit_app -r requirements.txt` (Yarn). Note that if you are using NPM, you need to add `--` before options such as `-r` in the `run` command ([ref](https://stackoverflow.com/questions/43046885/what-does-do-when-running-an-npm-command)).
44
+ - This `dump` command creates `./build` directory. It includes
45
+ - The stlite bare app files.
46
+ - `streamlit_app` directory copied from the one you created in the previous steps.
47
+ - `site-packages-snapshot.tar.gz` that includes the installed package files.
48
+ 8. Run `npm run serve` or `yarn serve` for preview.
49
+ - This command is just a wrapper of `electron` command as you can see at the `"scripts"` field in the `package.json`. It launches Electron and starts the app with `./build/electron/main.js`, which is specified at the `"main"` field in the `package.json`.
50
+ 9. Run `npm run dist` or `yarn dist` for packaging.
51
+ - This command bundles the `./build` directory created in the step above into application files (`.app`, `.exe`, `.dmg` etc.) in the `./dist` directory. To customize the built app, e.g. setting the icon, follow the [`electron-builder`](https://www.electron.build/) instructions.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stlite/desktop",
3
- "version": "0.21.1",
3
+ "version": "0.21.2",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "/",
6
6
  "main": "./build/electron/main.js",
@@ -57,8 +57,8 @@
57
57
  },
58
58
  "devDependencies": {
59
59
  "@craco/craco": "^6.1.2",
60
- "@stlite/common": "^0.21.1",
61
- "@stlite/kernel": "^0.21.1",
60
+ "@stlite/common": "^0.21.2",
61
+ "@stlite/kernel": "^0.21.2",
62
62
  "@testing-library/react": "^11.2.7",
63
63
  "@testing-library/user-event": "^13.1.9",
64
64
  "@types/jest": "^26.0.19",