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
* [WIP] Create stlite_webserver package and its Server class with unit tests copied from tornado-e2e package
* Use the new stlite server impl at ./py/stlite-webserver/stlite_webserver/__init__.py in worker.ts
* Check the websocket endpoint path
* Make stlite-web-server package and import its wheel from worker.ts like other packages
* Rename stlite-webserver to stlite-server
* Move the Server class to stlite_server.server
* Copy make_url_path_regex from streamlit.web.server_util
* Implement Server.receive_http()
* Implement UploadFileRequestHandler
* Add pytest, mypy and code formatters as dev dependencies
* Apply formatters
* Configure mypy to ignore pyodide
* Fix some typing errors
* Introduce Response class
* Refactoring
* Remove tornado
* Replace test-tornado-e2e with test-stlite-server CI job
* Add stlite-server-wheel Make rule
* Remove unused imports
* Fix typing
* Fix test
* Remove packages/kernel/py/e2etests
* Revert kernel/package.json
* Set necessary Streamlit config overrides
* Create stlite_server.bootstrap.prepare() to run necessary patching and mocking that streamlit.web.bootstrap.run() does on the upstream Streamlit
* Apply code formatter to bootstrap.py
* Extend the test case accessing the media endpoint to cover the case where the file is registered without its file name
* Create ComponentRequestHandler so custom components work
* Use SNOWPARK_CONDA_BUILD flag to exclude unnecessary requirements for the Streamlit package
* Update the desktop package to use stlite_server package and remove ssl packages
* Call runtime.stop() from server.stop()
* Update packages/kernel/py/README.md
* Rename tests/test_httpserver.py -> tests/test_server.py
* Fix
* Add bootstrap_test.py
* Fix .github/workflows/main.yml
* Fix typing settings
* Update packages/kernel/py/README.md
* Fix worker.ts
* Fix worker.ts
* Fix worker.ts
* Fix test_server.py
* Remove unused patches
* Remove Union
* Fix typing
* Rename logger object to match the original
* Fix httputil.py
* Fix typing
* Fix typing on tests
* Fix media_file_handler.py
* Add matplotlib for tests
* Fix media_file_handler.py
* Fix server.py
* Fix upload_file_request_handler.py
tornado-e2e: true # This step does not detect changes in the `streamlit` submodule that is needed to trigger the test-tornado-e2e job (https://github.com/dorny/paths-filter/issues/143), so skip checking and make it always return true as a workaround.
stlite-server: true # This step does not detect changes in the `streamlit` submodule that is needed to trigger the test-stlite-server job (https://github.com/dorny/paths-filter/issues/143), so skip checking and make it always return true as a workaround.
- name: Run linter and code formatter to the test code module
129
127
run: |
130
128
. .venv/bin/activate
131
-
cd packages/kernel/py/e2etests
129
+
cd packages/kernel/py/stlite-server
132
130
poetry run black . --check
133
131
poetry run isort . --check
134
132
poetry run flake8
135
133
136
134
- name: Run mypy
137
135
run: |
138
136
. .venv/bin/activate
139
-
cd packages/kernel/py/e2etests
137
+
cd packages/kernel/py/stlite-server
140
138
poetry run mypy .
141
139
142
140
- name: Run pytest
143
141
shell: bash
144
142
run: |
145
143
. .venv/bin/activate
146
-
cd packages/kernel/py/e2etests
144
+
cd packages/kernel/py/stlite-server
147
145
poetry run python -m pytest -v tests
148
146
149
147
test-mountable:
@@ -257,7 +255,7 @@ jobs:
257
255
258
256
build-kernel:
259
257
if: ${{ ! failure() }} # This job should run even if the depending jobs are skipped, but not when those jobs failed: https://qiita.com/abetomo/items/d9ede7dbeeb24f723fc5#%E8%A8%AD%E5%AE%9A%E4%BE%8B4
260
-
needs: [test-kernel, test-tornado-e2e]
258
+
needs: [test-kernel, test-stlite-server]
261
259
262
260
env:
263
261
python-version: "3.10"
@@ -378,7 +376,7 @@ jobs:
378
376
379
377
build-mountable:
380
378
if: ${{ ! failure() }} # This job should run even if the depending jobs are skipped, but not when those jobs failed: https://qiita.com/abetomo/items/d9ede7dbeeb24f723fc5#%E8%A8%AD%E5%AE%9A%E4%BE%8B4
if: ${{ ! failure() }} # This job should run even if the depending jobs are skipped, but not when those jobs failed: https://qiita.com/abetomo/items/d9ede7dbeeb24f723fc5#%E8%A8%AD%E5%AE%9A%E4%BE%8B4
if: ${{ ! failure() }} # This job should run even if the depending jobs are skipped, but not when those jobs failed: https://qiita.com/abetomo/items/d9ede7dbeeb24f723fc5#%E8%A8%AD%E5%AE%9A%E4%BE%8B4
if: ${{ ! failure() }} # This job should run even if the depending jobs are skipped, but not when those jobs failed: https://qiita.com/abetomo/items/d9ede7dbeeb24f723fc5#%E8%A8%AD%E5%AE%9A%E4%BE%8B4
Streamlit has 2 separate submodules, `web` and `runtime`.
4
+
We use `runtime` only, which contains all necessary core features of Streamlit, but we omit `web` because it relies on `tornado`, which cannot be installed on Pyodide, and even if we hack it to be installable, we don't need its full HTTP-compatible implementation. In contrast, we only need a small subset (or imitation) of HTTP for our original communication layer used in `worker.ts`, and we prioritize a smaller bundle size.
4
5
5
-
The original Tornado cannot be installed and run on Pyodide environment and stlite kernel needs a customized communication protocol, so we forked and customized it.
6
+
For that purpose, we created this package, `stlite-server`, including `server.Server` class.
7
+
It exposes methods for the WebSocket- and HTTP-like connections that are handled in `worker.ts`, and it also implements request handlers similar to the ones defined in the original server implementation, `streamlit.web.server.server.Server`.
6
8
7
-
### Implementation principles
8
-
* Simplicity and readability is the top priority.
9
-
* Neither reproducing the original behavior nor implementing the correct HTTP protocol is needed.
10
-
* We do not pay efforts to keep the original code. We do it if it supports reading and implementing the code, and we don't if it does not.
9
+
See the following links for the details.
10
+
* A PR where this package is created.
11
+
*https://github.com/whitphx/stlite/pull/492
12
+
* PRs for the upstream Streamlit repo where the `web` and `runtime` sub-packages are decoupled.
0 commit comments