Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/rename mountable #1243

Merged
merged 6 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ concurrency:
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

env:
GITHUB_PAGES_SUBDIR_MOUNTABLE: lib/mountable
GITHUB_PAGES_SUBDIR_BROWSER: lib/browser

jobs:
build:
strategy:
matrix:
target: ["mountable"]
target: ["browser"]

env:
# To avoid an error like "FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory".
Expand Down Expand Up @@ -72,23 +72,23 @@ jobs:
- name: Set up
run: make init

## Build and deploy @stlite/mountable
## Build and deploy @stlite/browser
# PUBLIC_URL here is set as a relative path, which is possible to the trick introduced at https://github.com/whitphx/stlite/pull/143.
- if: matrix.target == 'mountable'
- if: matrix.target == 'browser'
name: Set PUBLIC_URL
run: echo "PUBLIC_URL=." >> $GITHUB_ENV
- if: matrix.target == 'mountable'
name: Build @stlite/mountable
- if: matrix.target == 'browser'
name: Build @stlite/browser
run: |
. .venv/bin/activate
make mountable
make browser

- if: matrix.target == 'mountable'
- if: matrix.target == 'browser'
name: Upload the built files as an artifact
uses: actions/upload-artifact@v4
with:
name: stlite-mountable
path: packages/mountable/build
name: stlite-browser
path: packages/browser/build

deploy:
needs: build
Expand All @@ -102,8 +102,8 @@ jobs:
steps:
- uses: actions/download-artifact@v4
with:
name: stlite-mountable
path: mountable
name: stlite-browser
path: browser

- name: Configure redirect
run: |
Expand All @@ -124,8 +124,8 @@ jobs:

- name: Set the build artifact paths
run: |
mkdir -p /tmp/website/${GITHUB_PAGES_SUBDIR_MOUNTABLE}
cp -r ./mountable/* /tmp/website/${GITHUB_PAGES_SUBDIR_MOUNTABLE}/.
mkdir -p /tmp/website/${GITHUB_PAGES_SUBDIR_BROWSER}
cp -r ./browser/* /tmp/website/${GITHUB_PAGES_SUBDIR_BROWSER}/.

- name: Upload the website files as an artifact
uses: actions/upload-artifact@v4
Expand Down
58 changes: 29 additions & 29 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
kernel: ${{ steps.filter.outputs.kernel == 'true' || steps.filter.outputs.gha == 'true' || env.RUN_ALL_TESTS == 'true' }}
# stlite-lib: ${{ steps.filter.outputs.stlite-lib == 'true' || steps.filter.outputs.gha == 'true' || env.RUN_ALL_TESTS == 'true' }}
stlite-lib: true # This step does not detect changes in the `streamlit` submodule that is needed to trigger the test-stlite-lib job (https://github.com/dorny/paths-filter/issues/143), so skip checking and make it always return true as a workaround.
mountable: ${{ steps.filter.outputs.mountable == 'true' || steps.filter.outputs.gha == 'true' || env.RUN_ALL_TESTS == 'true' }}
browser: ${{ steps.filter.outputs.browser == 'true' || steps.filter.outputs.gha == 'true' || env.RUN_ALL_TESTS == 'true' }}
sharing-editor: ${{ steps.filter.outputs.sharing-editor == 'true' || steps.filter.outputs.gha == 'true' || env.RUN_ALL_TESTS == 'true' }}
sharing-common: ${{ steps.filter.outputs.sharing-common == 'true' || steps.filter.outputs.gha == 'true' || env.RUN_ALL_TESTS == 'true' }}
desktop: ${{ steps.filter.outputs.desktop == 'true' || steps.filter.outputs.gha == 'true' || env.RUN_ALL_TESTS == 'true' }}
Expand All @@ -52,8 +52,8 @@ jobs:
# stlite-lib: # We run this job anytime. See above.
# - 'packages/kernel/py/stlite-lib/**/*'
# - 'streamlit/**/*'
mountable:
- 'packages/mountable/**/*'
browser:
- 'packages/browser/**/*'
sharing-editor:
- 'packages/sharing-editor/**/*'
sharing-common:
Expand Down Expand Up @@ -165,15 +165,15 @@ jobs:
cd packages/kernel/py/stlite-lib
uv run pytest -v

test-mountable:
test-browser:
needs: changes
if: ${{ needs.changes.outputs.mountable == 'true' }}
if: ${{ needs.changes.outputs.browser == 'true' }}

runs-on: ubuntu-latest

defaults:
run:
working-directory: packages/mountable
working-directory: packages/browser

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -282,9 +282,9 @@ jobs:
- run: yarn typecheck
- run: yarn test

build-mountable:
build-browser:
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
needs: [test-kernel, test-stlite-lib, test-mountable]
needs: [test-kernel, test-stlite-lib, test-browser]

runs-on: ubuntu-latest

Expand All @@ -301,43 +301,43 @@ jobs:
python-version-file: ${{ env.python-version-file }}
node-version-file: ${{ env.node-version-file }}

## Build and deploy @stlite/mountable
## Build and deploy @stlite/browser
# PUBLIC_URL here is set as a relative path, which is possible to the trick introduced at https://github.com/whitphx/stlite/pull/143.
- name: Set PUBLIC_URL
run: echo "PUBLIC_URL=." >> $GITHUB_ENV
- name: Build @stlite/mountable
- name: Build @stlite/browser
run: |
. .venv/bin/activate
make mountable
make browser

- name: Package
working-directory: packages/mountable
working-directory: packages/browser
run: yarn pack

- name: Get the built package file path
id: get-package-file-path
working-directory: packages/mountable
run: echo "PACKAGE_FILE_PATH=$(find $(pwd) -name "stlite-mountable-*.tgz" -print -quit)" >> $GITHUB_OUTPUT
working-directory: packages/browser
run: echo "PACKAGE_FILE_PATH=$(find $(pwd) -name "stlite-browser-*.tgz" -print -quit)" >> $GITHUB_OUTPUT

- name: Upload the built tar ball as an artifact
uses: actions/upload-artifact@v4
if: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
with:
path: ${{ steps.get-package-file-path.outputs.PACKAGE_FILE_PATH }}
name: stlite-mountable-${{ github.sha }}.tgz
name: stlite-browser-${{ github.sha }}.tgz

- name: Upload the built tar ball as an artifact (when pushed with a version tag)
uses: actions/upload-artifact@v4
if: startsWith(github.ref, 'refs/tags/v')
with:
path: ${{ steps.get-package-file-path.outputs.PACKAGE_FILE_PATH }}
name: stlite-mountable-${{ github.ref_name }}.tgz
name: stlite-browser-${{ github.ref_name }}.tgz

- name: "Inform the package stats of @stlite/mountable"
- name: "Inform the package stats of @stlite/browser"
uses: ./.github/actions/inform-package-stats
with:
key: mountable
name: "@stlite/mountable"
key: browser
name: "@stlite/browser"
input-path: ${{ steps.get-package-file-path.outputs.PACKAGE_FILE_PATH }}

# Also get stats of the built wheel files of stlite-lib and streamlit in this job.
Expand All @@ -356,18 +356,18 @@ jobs:
uses: ./.github/actions/inform-package-stats
with:
key: stlite-lib-wheel
name: "stlite-lib wheel (built as a part of @stlite/mountable)"
name: "stlite-lib wheel (built as a part of @stlite/browser)"
input-path: ${{ steps.get-wheel-file-path.outputs.STLITE_LIB_WHEEL_FILEPATH }}
- name: "Inform the package stats of streamlit wheel"
uses: ./.github/actions/inform-package-stats
with:
key: streamlit-wheel
name: "streamlit wheel (built as a part of @stlite/mountable)"
name: "streamlit wheel (built as a part of @stlite/browser)"
input-path: ${{ steps.get-wheel-file-path.outputs.STREAMLIT_WHEEL_FILEPATH }}

publish-mountable:
publish-browser:
if: ${{ !failure() && startsWith(github.ref, 'refs/tags/v') }} # `!failure()` is necessary to avoid skipping this job after successful build: https://github.com/actions/runner/issues/491
needs: [build-mountable]
needs: [build-browser]

permissions:
contents: write # Necessary for creating releases: https://github.com/softprops/action-gh-release#permissions
Expand All @@ -385,18 +385,18 @@ jobs:

- uses: actions/download-artifact@v4
with:
name: stlite-mountable-${{ github.ref_name }}.tgz
path: packages/mountable
name: stlite-browser-${{ github.ref_name }}.tgz
path: packages/browser

- run: yarn publish stlite-mountable-v*.tgz --access public
- run: yarn publish stlite-browser-v*.tgz --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
working-directory: packages/mountable
working-directory: packages/browser

- name: Create a new release
uses: softprops/action-gh-release@v2
with:
files: packages/mountable/stlite-mountable-v*.tgz
files: packages/browser/stlite-browser-v*.tgz
generate_release_notes: true

build-sharing:
Expand Down Expand Up @@ -728,7 +728,7 @@ jobs:
if: ${{ !failure() && startsWith(github.ref, 'refs/tags/v') }} # `!failure()` is necessary to avoid skipping this job after successful build: https://github.com/actions/runner/issues/491
needs:
- test-build-vscode-extension
- publish-mountable # The VSC extension uses the same version of published @stlite/mountable, so it must be released in order.
- publish-browser # The VSC extension uses the same version of published @stlite/browser, so it must be released in order.

permissions:
contents: write # Necessary for creating releases: https://github.com/softprops/action-gh-release#permissions
Expand Down
4 changes: 2 additions & 2 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ cd packages/kernel
yarn start
```

#### `@stlite/mountable`
#### `@stlite/browser`

```shell
cd packages/mountable
cd packages/browser
yarn start
```

Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ node_modules := $(BUILD_STATE_DIR)/node_modules/.built
venv := $(BUILD_STATE_DIR)/venv/.built
common := $(BUILD_STATE_DIR)/common/.built
common-react := $(BUILD_STATE_DIR)/common-react/.built
mountable := $(BUILD_STATE_DIR)/mountable/.built
browser := $(BUILD_STATE_DIR)/browser/.built
sharing := $(BUILD_STATE_DIR)/sharing/.built
sharing-common := $(BUILD_STATE_DIR)/sharing-common/.built
sharing-editor := $(BUILD_STATE_DIR)/sharing-editor/.built
Expand All @@ -50,7 +50,7 @@ streamlit_frontend_lib_prod := streamlit/frontend/lib/dist/*
export USE_CONSTRAINTS_FILE := false # https://github.com/streamlit/streamlit/blob/1.27.0/.github/workflows/release.yml#L67-L68

.PHONY: all
all: init $(mountable) $(sharing) $(sharing-editor) $(desktop)
all: init $(browser) $(sharing) $(sharing-editor) $(desktop)


.PHONY: init
Expand Down Expand Up @@ -99,10 +99,10 @@ $(common-react): $(shell find packages/common-react/src -type f \( -name "*.ts"
@mkdir -p $(dir $@)
@touch $@

.PHONY: mountable
mountable: $(mountable)
$(mountable): $(shell find packages/mountable/src -type f \( -name "*.ts" -o -name "*.tsx" \) ) $(node_modules) $(kernel) $(common) $(common-react)
cd packages/mountable && yarn build
.PHONY: browser
browser: $(browser)
$(browser): $(shell find packages/browser/src -type f \( -name "*.ts" -o -name "*.tsx" \) ) $(node_modules) $(kernel) $(common) $(common-react)
cd packages/browser && yarn build
@mkdir -p $(dir $@)
@touch $@

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions packages/browser/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# `@stlite/browser`

Mount a Streamlit app on a static web page.

See https://github.com/whitphx/stlite#readme
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Stlite Mountable dev page</title>
<title>Stlite Browser dev page</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "@stlite/mountable",
"name": "@stlite/browser",
"version": "0.75.0",
"type": "module",
"description": "Mountable Stlite application",
"description": "Browser Stlite",
"keywords": [
"stlite",
"streamlit",
Expand All @@ -25,7 +25,7 @@
"repository": {
"type": "git",
"url": "https://github.com/whitphx/stlite.git",
"directory": "packages/mountable"
"directory": "packages/browser"
},
"dependencies": {
"@stlite/common": "^0.75.0",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 0 additions & 5 deletions packages/mountable/README.md

This file was deleted.

Loading