Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

chore: publish fe assets to npm (#302)

Myles Scolnickcc93e521227f
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 79ab8759df..725e2c6730 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -4,7 +4,7 @@ name: Publish release
on:
push:
tags:
- - '[0-9]+.[0-9]+.[0-9]+'
+ - "[0-9]+.[0-9]+.[0-9]+"
jobs:
publish_release:
@@ -52,3 +52,15 @@ jobs:
TWINE_USERNAME: ${{ secrets.PYPI_USER }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: twine upload --skip-existing dist/*
+
+ - name: 📦 Update package.json version from CLI
+ working-directory: frontend
+ run: |
+ echo "Updating package.json version to $(marimo --version)"
+ npm version $(marimo --version) --no-git-tag-version
+
+ - name: 📤 Upload to npm
+ working-directory: frontend
+ env:
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
+ run: npm publish --access public
diff --git a/frontend/.storybook/preview-head.html b/frontend/.storybook/preview-head.html
index 18870a1cc2..c9c1f13c54 100644
--- a/frontend/.storybook/preview-head.html
+++ b/frontend/.storybook/preview-head.html
@@ -1,5 +1,6 @@
<marimo-filename hidden>app.py</marimo-filename>
<marimo-mode data-mode="edit" hidden></marimo-mode>
+<marimo-version data-mode="0.1.0" hidden></marimo-version>
<marimo-user-config
data-config='{"completion":{"activate_on_typing":false, "copilot": true},"save":{"autosave":"off","autosave_delay":0},"keymap":{"preset":"default"},"experimental":{"theming":true}}'
hidden
diff --git a/frontend/index.html b/frontend/index.html
index 7ddc735ae2..1427367816 100644
--- a/frontend/index.html
+++ b/frontend/index.html
@@ -21,6 +21,7 @@
</script>
<marimo-filename hidden>{{ filename }}</marimo-filename>
<marimo-mode data-mode={{ mode }} hidden></marimo-mode>
+ <marimo-version data-version={{ version }} hidden></marimo-version>
<marimo-user-config data-config='{{ user_config }}' hidden></marimo-user-config>
<marimo-app-config data-config='{{ app_config }}' hidden></marimo-app-config>
<title>{{ title }}</title>
diff --git a/frontend/package.json b/frontend/package.json
index a140811dbd..dfc3f2fdfa 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -1,14 +1,15 @@
{
- "name": "@marimo-team/app",
- "version": "0.1.15",
+ "name": "@marimo-team/frontend",
+ "version": "0.0.0-placeholder",
"main": "lib/marimo.js",
"types": "lib/index.d.ts",
+ "license": "Apache-2.0",
"sideEffects": [
"*.css",
"*.css.ts"
],
"files": [
- "lib"
+ "dist"
],
"dependencies": {
"@codemirror/autocomplete": "^6.10.2",
diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts
index ad9e1e4d8b..4bb6633264 100644
--- a/frontend/vite.config.ts
+++ b/frontend/vite.config.ts
@@ -11,6 +11,7 @@ const htmlDevPlugin = (): Plugin => {
return html
.replace(`{{ filename }}`, `dev-mode`)
.replace(`{{ mode }}`, `"edit"`)
+ .replace(`{{ version }}`, `"0.1.0"`)
.replace(
`{{ user_config }}`,
JSON.stringify({
diff --git a/marimo/_cli/cli.py b/marimo/_cli/cli.py
index bd8cec483c..3822bf032d 100644
--- a/marimo/_cli/cli.py
+++ b/marimo/_cli/cli.py
@@ -106,7 +106,7 @@ main_help_msg = "\n".join(
@click.group(help=main_help_msg)
[email protected]_option(version=__version__)
[email protected]_option(version=__version__, message="%(version)s")
@click.option(
"-l",
"--log-level",
diff --git a/marimo/_cli/test_cli.py b/marimo/_cli/test_cli.py
index cb44958765..607f0510b4 100644
--- a/marimo/_cli/test_cli.py
+++ b/marimo/_cli/test_cli.py
@@ -12,6 +12,7 @@ import time
import urllib.request
from typing import Optional
+from marimo import __version__
from marimo._ast import codegen
from marimo._ast.cell import CellConfig
@@ -72,6 +73,9 @@ def test_cli_edit() -> None:
p = subprocess.Popen(["marimo", "edit", "-p", str(port), "--headless"])
contents = _try_fetch(port)
_check_contents(p, b"marimo-mode data-mode=edit", contents)
+ _check_contents(
+ p, f"marimo-version data-version={__version__}".encode(), contents
+ )
def test_cli_run() -> None:
@@ -89,6 +93,9 @@ def test_cli_run() -> None:
)
contents = _try_fetch(port)
_check_contents(p, b"marimo-mode data-mode=read", contents)
+ _check_contents(
+ p, f"marimo-version data-version={__version__}".encode(), contents
+ )
def test_cli_tutorial() -> None:
@@ -98,4 +105,7 @@ def test_cli_tutorial() -> None:
)
contents = _try_fetch(port)
_check_contents(p, b"marimo-mode data-mode=edit", contents)
+ _check_contents(
+ p, f"marimo-version data-version={__version__}".encode(), contents
+ )
_check_contents(p, b"intro.py", contents)
diff --git a/marimo/_server/server.py b/marimo/_server/server.py
index c98fa613b5..fda5a538d4 100644
--- a/marimo/_server/server.py
+++ b/marimo/_server/server.py
@@ -29,7 +29,7 @@ import tornado.ioloop
import tornado.web
import tornado.websocket
-from marimo import _loggers
+from marimo import __version__, _loggers
from marimo._config.config import get_configuration
from marimo._config.utils import load_config
from marimo._server import api, sessions
@@ -122,6 +122,7 @@ class MainHandler(tornado.web.RequestHandler):
title=title,
filename=mgr.filename if mgr.filename is not None else "",
mode="read" if mgr.mode == sessions.SessionMode.RUN else "edit",
+ version=__version__,
user_config=json.dumps(user_config),
app_config=json.dumps(app_config),
)