diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 88e1474a6..90b1f2b1d 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -13,6 +13,7 @@ concurrency: env: GITHUB_PAGES_SUBDIR_MOUNTABLE: lib/mountable + USE_CONSTRAINT_FILE: false # https://github.com/streamlit/streamlit/blob/1.23.1/.github/workflows/release.yml#L61-L62 jobs: build: @@ -71,9 +72,19 @@ jobs: node-version-file: .nvmrc cache: 'yarn' - ## Set up apt packages. Ref: https://github.com/streamlit/streamlit/wiki/Contributing#ubuntu - - name: Install Streamlit build dependencies - run: sudo apt install protobuf-compiler + # We require protoc >= 3.20, but Ubuntu 22.04 - the OS that these Github + # Actions are running as of 2023.05.03 - doesn't have recent versions + # of protoc in its package repository. + # Ref: https://github.com/streamlit/streamlit/blob/1.23.1/.github/actions/make_init/action.yml#L47-L56 + # So we download the precompiled binary from the release page and install it, + # following https://grpc.io/docs/protoc-installation/#install-pre-compiled-binaries-any-os + - name: Install protoc + run: | + curl -LO $PB_REL/download/v3.20.3/protoc-3.20.3-linux-x86_64.zip + unzip protoc-3.20.3-linux-x86_64.zip -d $HOME/.local + echo "$HOME/.local/bin" >> $GITHUB_PATH + env: + PB_REL: "https://github.com/protocolbuffers/protobuf/releases" - name: Set up run: make init diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f5d628775..f453159d2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,6 +7,9 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true +env: + USE_CONSTRAINT_FILE: false # https://github.com/streamlit/streamlit/blob/1.23.1/.github/workflows/release.yml#L61-L62 + jobs: changes: # See https://github.com/dorny/paths-filter#examples runs-on: ubuntu-latest @@ -118,10 +121,19 @@ jobs: cd packages/kernel/py/stlite-server poetry install - # Set up the /streamlit submodule - ## Set up apt packages. Ref: https://github.com/streamlit/streamlit/wiki/Contributing#ubuntu - - name: Install Streamlit build dependencies - run: sudo apt install protobuf-compiler + # We require protoc >= 3.20, but Ubuntu 22.04 - the OS that these Github + # Actions are running as of 2023.05.03 - doesn't have recent versions + # of protoc in its package repository. + # Ref: https://github.com/streamlit/streamlit/blob/1.23.1/.github/actions/make_init/action.yml#L47-L56 + # So we download the precompiled binary from the release page and install it, + # following https://grpc.io/docs/protoc-installation/#install-pre-compiled-binaries-any-os + - name: Install protoc + run: | + curl -LO $PB_REL/download/v3.20.3/protoc-3.20.3-linux-x86_64.zip + unzip protoc-3.20.3-linux-x86_64.zip -d $HOME/.local + echo "$HOME/.local/bin" >> $GITHUB_PATH + env: + PB_REL: "https://github.com/protocolbuffers/protobuf/releases" - name: Set up Streamlit and build proto run: | . .venv/bin/activate @@ -313,9 +325,19 @@ jobs: node-version-file: .nvmrc cache: 'yarn' - ## Set up apt packages. Ref: https://github.com/streamlit/streamlit/wiki/Contributing#ubuntu - - name: Install Streamlit build dependencies - run: sudo apt install protobuf-compiler + # We require protoc >= 3.20, but Ubuntu 22.04 - the OS that these Github + # Actions are running as of 2023.05.03 - doesn't have recent versions + # of protoc in its package repository. + # Ref: https://github.com/streamlit/streamlit/blob/1.23.1/.github/actions/make_init/action.yml#L47-L56 + # So we download the precompiled binary from the release page and install it, + # following https://grpc.io/docs/protoc-installation/#install-pre-compiled-binaries-any-os + - name: Install protoc + run: | + curl -LO $PB_REL/download/v3.20.3/protoc-3.20.3-linux-x86_64.zip + unzip protoc-3.20.3-linux-x86_64.zip -d $HOME/.local + echo "$HOME/.local/bin" >> $GITHUB_PATH + env: + PB_REL: "https://github.com/protocolbuffers/protobuf/releases" - name: Set up run: make init @@ -434,9 +456,19 @@ jobs: node-version-file: .nvmrc cache: 'yarn' - ## Set up apt packages. Ref: https://github.com/streamlit/streamlit/wiki/Contributing#ubuntu - - name: Install Streamlit build dependencies - run: sudo apt install protobuf-compiler + # We require protoc >= 3.20, but Ubuntu 22.04 - the OS that these Github + # Actions are running as of 2023.05.03 - doesn't have recent versions + # of protoc in its package repository. + # Ref: https://github.com/streamlit/streamlit/blob/1.23.1/.github/actions/make_init/action.yml#L47-L56 + # So we download the precompiled binary from the release page and install it, + # following https://grpc.io/docs/protoc-installation/#install-pre-compiled-binaries-any-os + - name: Install protoc + run: | + curl -LO $PB_REL/download/v3.20.3/protoc-3.20.3-linux-x86_64.zip + unzip protoc-3.20.3-linux-x86_64.zip -d $HOME/.local + echo "$HOME/.local/bin" >> $GITHUB_PATH + env: + PB_REL: "https://github.com/protocolbuffers/protobuf/releases" - name: Set up run: make init @@ -555,9 +587,19 @@ jobs: node-version-file: .nvmrc cache: 'yarn' - ## Set up apt packages. Ref: https://github.com/streamlit/streamlit/wiki/Contributing#ubuntu - - name: Install Streamlit build dependencies - run: sudo apt install protobuf-compiler + # We require protoc >= 3.20, but Ubuntu 22.04 - the OS that these Github + # Actions are running as of 2023.05.03 - doesn't have recent versions + # of protoc in its package repository. + # Ref: https://github.com/streamlit/streamlit/blob/1.23.1/.github/actions/make_init/action.yml#L47-L56 + # So we download the precompiled binary from the release page and install it, + # following https://grpc.io/docs/protoc-installation/#install-pre-compiled-binaries-any-os + - name: Install protoc + run: | + curl -LO $PB_REL/download/v3.20.3/protoc-3.20.3-linux-x86_64.zip + unzip protoc-3.20.3-linux-x86_64.zip -d $HOME/.local + echo "$HOME/.local/bin" >> $GITHUB_PATH + env: + PB_REL: "https://github.com/protocolbuffers/protobuf/releases" - name: Set up run: make init @@ -721,9 +763,19 @@ jobs: node-version-file: .nvmrc cache: 'yarn' - ## Set up apt packages. Ref: https://github.com/streamlit/streamlit/wiki/Contributing#ubuntu - - name: Install Streamlit build dependencies - run: sudo apt install protobuf-compiler + # We require protoc >= 3.20, but Ubuntu 22.04 - the OS that these Github + # Actions are running as of 2023.05.03 - doesn't have recent versions + # of protoc in its package repository. + # Ref: https://github.com/streamlit/streamlit/blob/1.23.1/.github/actions/make_init/action.yml#L47-L56 + # So we download the precompiled binary from the release page and install it, + # following https://grpc.io/docs/protoc-installation/#install-pre-compiled-binaries-any-os + - name: Install protoc + run: | + curl -LO $PB_REL/download/v3.20.3/protoc-3.20.3-linux-x86_64.zip + unzip protoc-3.20.3-linux-x86_64.zip -d $HOME/.local + echo "$HOME/.local/bin" >> $GITHUB_PATH + env: + PB_REL: "https://github.com/protocolbuffers/protobuf/releases" - name: Set up run: make init diff --git a/Makefile b/Makefile index 01df9aeac..b7755bde7 100644 --- a/Makefile +++ b/Makefile @@ -7,8 +7,8 @@ sharing-editor := packages/sharing-editor/build/* desktop := packages/desktop/build/* kernel := packages/kernel/dist/* stlite-server-wheel := packages/kernel/py/stlite-server/dist/stlite_server-0.1.0-py3-none-any.whl -streamlit_proto := streamlit/frontend/src/autogen -streamlit_wheel := packages/kernel/py/streamlit/lib/dist/streamlit-1.21.0-py2.py3-none-any.whl +streamlit_proto := streamlit/frontend/src/lib/proto.d.ts +streamlit_wheel := packages/kernel/py/streamlit/lib/dist/streamlit-1.23.1-py2.py3-none-any.whl .PHONY: all all: init mountable sharing sharing-editor @@ -119,4 +119,4 @@ $(streamlit_wheel): $(VENV) $(streamlit_proto) streamlit/lib/streamlit/**/*.py s cd streamlit && \ SNOWPARK_CONDA_BUILD=true $(MAKE) distribution mkdir -p `dirname $(streamlit_wheel)` - cp streamlit/lib/dist/streamlit-1.21.0-py2.py3-none-any.whl $(streamlit_wheel) + cp streamlit/lib/dist/streamlit-1.23.1-py2.py3-none-any.whl $(streamlit_wheel) diff --git a/packages/common-react/src/toastify-components/theme.ts b/packages/common-react/src/toastify-components/theme.ts index 86a9a69be..a53ebaa06 100644 --- a/packages/common-react/src/toastify-components/theme.ts +++ b/packages/common-react/src/toastify-components/theme.ts @@ -1,8 +1,8 @@ import { LocalStore, localStorageAvailable, -} from "streamlit-browser/src/lib/storageUtils"; -import { darkTheme } from "streamlit-browser/src/theme/themeConfigs"; +} from "streamlit-browser/src/lib/util/storageUtils"; +import { darkTheme } from "streamlit-browser/src/lib/theme/themeConfigs"; function isSystemDarkTheme(): boolean { // Detect the system color mode. Ref: https://stackoverflow.com/a/57795495/13103190 diff --git a/packages/common-react/tsconfig.json b/packages/common-react/tsconfig.json index e5aa3e67d..244d536e0 100644 --- a/packages/common-react/tsconfig.json +++ b/packages/common-react/tsconfig.json @@ -32,7 +32,6 @@ "src/theme": ["../../streamlit/frontend/src/theme"], "src/theme/*": ["../../streamlit/frontend/src/theme/*"], "src/lib/*": ["../../streamlit/frontend/src/lib/*"], - "src/autogen/*": ["../../streamlit/frontend/src/autogen/*"] } /* Specify a set of entries that re-map imports to additional lookup locations. */, // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */ diff --git a/packages/desktop/bin/dump_artifacts.ts b/packages/desktop/bin/dump_artifacts.ts index bee65c202..0e53b6943 100755 --- a/packages/desktop/bin/dump_artifacts.ts +++ b/packages/desktop/bin/dump_artifacts.ts @@ -83,7 +83,7 @@ async function inspectUsedBuiltinPackages( await pyodide.loadPackage("micropip"); const micropip = pyodide.pyimport("micropip"); - micropip.add_mock_package("streamlit", "1.21.0"); + micropip.add_mock_package("streamlit", "1.23.1"); await micropip.install(options.requirements); return Object.entries(pyodide.loadedPackages) @@ -149,7 +149,7 @@ async function createSitePackagesSnapshot( pyodide, path.join( stliteKernelPyDir, - "streamlit/lib/dist/streamlit-1.21.0-py2.py3-none-any.whl" + "streamlit/lib/dist/streamlit-1.23.1-py2.py3-none-any.whl" ) ); } else { diff --git a/packages/desktop/src/StreamlitApp.tsx b/packages/desktop/src/StreamlitApp.tsx index b4841a303..3bf68b261 100644 --- a/packages/desktop/src/StreamlitApp.tsx +++ b/packages/desktop/src/StreamlitApp.tsx @@ -2,7 +2,7 @@ import React from "react"; import { StliteKernel, StliteKernelProvider } from "@stlite/kernel"; -import ThemedApp from "streamlit-browser/src/ThemedApp"; +import ThemedApp from "streamlit-browser/src/app/ThemedApp"; import { Client as Styletron } from "styletron-engine-atomic"; import { Provider as StyletronProvider } from "styletron-react"; const engine = new Styletron({ prefix: "st-" }); diff --git a/packages/kernel/src/kernel.ts b/packages/kernel/src/kernel.ts index 184b1e9f1..5a0b437bf 100644 --- a/packages/kernel/src/kernel.ts +++ b/packages/kernel/src/kernel.ts @@ -2,7 +2,7 @@ import { PromiseDelegate } from "@lumino/coreutils"; -import type { IAllowedMessageOriginsResponse } from "streamlit-browser/src/hocs/withHostCommunication/types"; +import type { IAllowedMessageOriginsResponse } from "streamlit-browser/src/lib/hocs/withHostCommunication/types"; import { makeAbsoluteWheelURL } from "./url"; import { CrossOriginWorkerMaker as Worker } from "./cross-origin-worker"; @@ -28,7 +28,7 @@ import type { // https://github.com/pyodide/pyodide/pull/1859 // https://pyodide.org/en/stable/project/changelog.html#micropip import STLITE_SERVER_WHEEL from "!!file-loader?name=pypi/[name].[ext]&context=.!../py/stlite-server/dist/stlite_server-0.1.0-py3-none-any.whl"; // TODO: Extract the import statement to an auto-generated file like `_pypi.ts` in JupyterLite: https://github.com/jupyterlite/jupyterlite/blob/f2ecc9cf7189cb19722bec2f0fc7ff5dfd233d47/packages/pyolite-kernel/src/_pypi.ts -import STREAMLIT_WHEEL from "!!file-loader?name=pypi/[name].[ext]&context=.!../py/streamlit/lib/dist/streamlit-1.21.0-py2.py3-none-any.whl"; +import STREAMLIT_WHEEL from "!!file-loader?name=pypi/[name].[ext]&context=.!../py/streamlit/lib/dist/streamlit-1.23.1-py2.py3-none-any.whl"; // Ref: https://github.com/streamlit/streamlit/blob/1.12.2/frontend/src/lib/UriUtil.ts#L32-L33 const FINAL_SLASH_RE = /\/+$/; diff --git a/packages/kernel/src/react-helpers/image-list.ts b/packages/kernel/src/react-helpers/image-list.ts index e3bd5dbec..751b6c220 100644 --- a/packages/kernel/src/react-helpers/image-list.ts +++ b/packages/kernel/src/react-helpers/image-list.ts @@ -1,6 +1,6 @@ import { useState, useEffect } from "react"; import { useStliteKernel } from "./StliteKernelProvider"; -import { IImage, Image as ImageProto } from "src/autogen/proto"; +import { IImage, Image as ImageProto } from "src/lib/proto"; /** * Overrides an image array by loading data from the stlite kernel diff --git a/packages/kernel/src/streamlit-replacements/lib/ConnectionManager.ts b/packages/kernel/src/streamlit-replacements/lib/ConnectionManager.ts index f38d00926..b46ab6705 100644 --- a/packages/kernel/src/streamlit-replacements/lib/ConnectionManager.ts +++ b/packages/kernel/src/streamlit-replacements/lib/ConnectionManager.ts @@ -1,15 +1,15 @@ // Mimic https://github.com/streamlit/streamlit/blob/1.9.0/frontend/src/lib/ConnectionManager.ts // and WebsocketConnection. -import { BackMsg, ForwardMsg } from "streamlit-browser/src/autogen/proto" -import type { IAllowedMessageOriginsResponse } from "streamlit-browser/src/hocs/withHostCommunication/types" -import type { BaseUriParts } from "streamlit-browser/src/lib/UriUtil" +import { BackMsg, ForwardMsg } from "streamlit-browser/src/lib/proto" +import type { IAllowedMessageOriginsResponse } from "streamlit-browser/src/lib/hocs/withHostCommunication/types" +import type { BaseUriParts } from "streamlit-browser/src/lib/util/UriUtil" import type { ReactNode } from "react" import type { StliteKernel } from "../../kernel" -import { ConnectionState } from "streamlit-browser/src/lib/ConnectionState" +import { ConnectionState } from "streamlit-browser/src/app/connection/ConnectionState" import type { SessionInfo } from "streamlit-browser/src/lib/SessionInfo" -import { ensureError } from "streamlit-browser/src/lib/ErrorHandling" +import { ensureError } from "streamlit-browser/src/lib/util/ErrorHandling" import { DUMMY_BASE_HOSTNAME, DUMMY_BASE_PORT } from "../../consts" interface MessageQueue { diff --git a/packages/kernel/src/streamlit-replacements/lib/FileUploadClient.ts b/packages/kernel/src/streamlit-replacements/lib/FileUploadClient.ts index 19788b09b..53561a98c 100644 --- a/packages/kernel/src/streamlit-replacements/lib/FileUploadClient.ts +++ b/packages/kernel/src/streamlit-replacements/lib/FileUploadClient.ts @@ -19,9 +19,9 @@ import type { CancelToken } from "axios" import type { SessionInfo } from "streamlit-browser/src/lib/SessionInfo" import _ from "lodash" -import type { BaseUriParts } from "streamlit-browser/src/lib/UriUtil" +import type { BaseUriParts } from "streamlit-browser/src/lib/util/UriUtil" import { FormDataEncoder, FormDataLike } from "form-data-encoder" -import { isValidFormId } from "streamlit-browser/src/lib/utils" +import { isValidFormId } from "streamlit-browser/src/lib/util/utils" import type { StliteKernel } from "../../kernel" /** Common widget protobuf fields that are used by the FileUploadClient. */ diff --git a/packages/kernel/tsconfig.json b/packages/kernel/tsconfig.json index 91c1781b9..48e280d3c 100644 --- a/packages/kernel/tsconfig.json +++ b/packages/kernel/tsconfig.json @@ -30,7 +30,6 @@ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ "paths": { "src/lib/*": ["../../streamlit/frontend/src/lib/*"], - "src/autogen/*": ["../../streamlit/frontend/src/autogen/*"], "src/theme": ["../../streamlit/frontend/src/theme"], "src/theme/*": ["../../streamlit/frontend/src/theme/*"], }, /* Specify a set of entries that re-map imports to additional lookup locations. */ diff --git a/packages/mountable/src/StreamlitApp.tsx b/packages/mountable/src/StreamlitApp.tsx index 9b5d5fc2a..ac0642832 100644 --- a/packages/mountable/src/StreamlitApp.tsx +++ b/packages/mountable/src/StreamlitApp.tsx @@ -2,7 +2,7 @@ import React from "react"; import { StliteKernel, StliteKernelProvider } from "@stlite/kernel"; -import ThemedApp from "streamlit-browser/src/ThemedApp"; +import ThemedApp from "streamlit-browser/src/app/ThemedApp"; import { Client as Styletron } from "styletron-engine-atomic"; import { Provider as StyletronProvider } from "styletron-react"; const engine = new Styletron({ prefix: "st-" }); diff --git a/packages/sharing/src/StreamlitApp.tsx b/packages/sharing/src/StreamlitApp.tsx index 9b5d5fc2a..ac0642832 100644 --- a/packages/sharing/src/StreamlitApp.tsx +++ b/packages/sharing/src/StreamlitApp.tsx @@ -2,7 +2,7 @@ import React from "react"; import { StliteKernel, StliteKernelProvider } from "@stlite/kernel"; -import ThemedApp from "streamlit-browser/src/ThemedApp"; +import ThemedApp from "streamlit-browser/src/app/ThemedApp"; import { Client as Styletron } from "styletron-engine-atomic"; import { Provider as StyletronProvider } from "styletron-react"; const engine = new Styletron({ prefix: "st-" }); diff --git a/packages/toy-app/src/App.tsx b/packages/toy-app/src/App.tsx index 09defcc80..eff8b6334 100644 --- a/packages/toy-app/src/App.tsx +++ b/packages/toy-app/src/App.tsx @@ -6,7 +6,7 @@ import { ConnectionManager, ConnectionState, } from "@stlite/kernel"; -import { BackMsg } from "streamlit-browser/src/autogen/proto"; +import { BackMsg } from "streamlit-browser/src/lib/proto"; function App() { useEffect(() => { diff --git a/streamlit b/streamlit index be85a52c4..b3bbc7d84 160000 --- a/streamlit +++ b/streamlit @@ -1 +1 @@ -Subproject commit be85a52c4faeffba6e781c3ff8d4beb3d6acf482 +Subproject commit b3bbc7d84a298a87617813f4286c09ab27c28939