Skip to content

Commit

Permalink
fix: include index.html in marimo-base for html export
Browse files Browse the repository at this point in the history
  • Loading branch information
mscolnick committed Nov 4, 2024
1 parent a1f5b30 commit 4806d0f
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 6 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/dev-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ jobs:
sed -i "s/__version__ = \".*\"/__version__ = \"$MARIMO_VERSION\"/" marimo/__init__.py
- name: 📦 Build marimo
run: hatch build
run: hatch build --clean

- name: 📦 Validate wheel under 2mb
run: ./scripts/validate_base_wheel_size.sh

- name: 📤 Upload to TestPyPI
env:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/marimo-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ jobs:
sed -i "s/__version__ = \".*\"/__version__ = \"$MARIMO_VERSION\"/" marimo/__init__.py
- name: 📦 Build marimo
run: hatch build
run: hatch build --clean

- name: 📦 Validate wheel under 2mb
run: ./scripts/validate_base_wheel_size.sh

- name: 📤 Upload to TestPyPI
env:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/release-marimo-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ jobs:
run: ./scripts/modify_pyproject_for_marimo_base.sh

- name: 📦 Build marimo-base
run: hatch build
run: hatch build --clean

- name: 📦 Validate wheel under 2mb
run: ./scripts/validate_base_wheel_size.sh

- name: 📤 Upload to PyPI
env:
Expand Down
6 changes: 3 additions & 3 deletions scripts/modify_pyproject_for_marimo_base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
# per Python project. This modifies the pyproject.toml
# to build marimo-base, a slimmed down marimo distribution with
# no static artifacts.
#
#
# Adapted from https://github.com/cvxpy/cvxpy/blob/297278e2a88db3c0084750052a16e60672074da3/.github/workflows/build.yml#L169C1-L180C1
#
# Mac has a different syntax for sed -i, this works across oses
sed -i.bak -e 's/name = "marimo"/name = "marimo-base"/g' pyproject.toml
# Remove static artifacts
sed -i.bak '/artifacts = /d' pyproject.toml
# Replace static artifacts with just index.html
sed -i.bak 's/artifacts = \[.*\]/artifacts = ["marimo\/_static\/index.html"]/' pyproject.toml
rm -rf pyproject.toml.bak
17 changes: 17 additions & 0 deletions scripts/validate_base_wheel_size.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

wheel_file=$(ls dist/*.whl)
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
size=$(stat -f%z "$wheel_file")
else
# Linux
size=$(stat -c%s "$wheel_file")
fi

if [ $size -gt 2097152 ]; then
echo "Wheel file is larger than 2mb"
exit 1
fi

echo "Wheel file is $size bytes"

0 comments on commit 4806d0f

Please sign in to comment.