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.

Switch to `uv_build` as PEP 517 build-system (#5778)

Trevor Manzc9dc88cea64b
diff --git a/.github/workflows/dev-release.yml b/.github/workflows/dev-release.yml
index 228a5d167d..2c308395de 100644
--- a/.github/workflows/dev-release.yml
+++ b/.github/workflows/dev-release.yml
@@ -44,16 +44,16 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- - name: 🥚 Install Hatch
- uses: pypa/hatch@install
+ - name: Install uv
+ uses: astral-sh/setup-uv@v6
- # patch __init__.py version to be of the form
+ # patch pyproject.toml version to be of the form
# X.Y.<Z+1>-dev{n-commits-since-last-tag}
- name: 🔨 Patch version number
run: |
# Get the version number and increment patch
# - assumes version is on a line of the form __version__ == "x.y.z"
- incremented_version=`grep '__version__' marimo/__init__.py | awk '{print $3}' | awk -F. '{printf "%d.%d.%d", $1, $2, $3+1}'`
+ incremented_version=`uv version --short | awk -F. '{printf "%d.%d.%d", $1, $2, $3+1}'`
# Get the number of commits since last tag
n_commits=`git rev-list $(git describe --tags --abbrev=0)..HEAD --count`
# Form the new version, which is one patch ahead of the last version
@@ -61,22 +61,24 @@ jobs:
MARIMO_VERSION="${incremented_version}-dev${n_commits}"
# Set the version in the environment for later steps
echo "MARIMO_VERSION=$MARIMO_VERSION" >> $GITHUB_ENV
- sed -i "s/__version__ = \".*\"/__version__ = \"$MARIMO_VERSION\"/" marimo/__init__.py
+ uv version "$MARIMO_VERSION"
+ env:
+ NO_COLOR: 1
- name: 📦 Build marimo
- run: hatch build
+ run: uv build
- name: 📤 Upload to TestPyPI (marimo)
env:
HATCH_INDEX_USER: ${{ secrets.TEST_PYPI_USER }}
HATCH_INDEX_AUTH: ${{ secrets.TEST_PYPI_PASSWORD }}
- run: hatch publish --repo test
+ run: uvx hatch publish --repo test
- name: Adapt pyproject.toml to build marimo-base
- run: ./scripts/modify_pyproject_for_marimo_base.sh
+ run: ./scripts/modify_pyproject_for_marimo_base.py
- name: 📦 Build marimo
- run: hatch build --clean
+ run: uvx hatch build --clean
- name: 📦 Validate wheel under 2mb
run: ./scripts/validate_base_wheel_size.sh
@@ -85,7 +87,7 @@ jobs:
env:
HATCH_INDEX_USER: ${{ secrets.TEST_PYPI_USER }}
HATCH_INDEX_AUTH: ${{ secrets.TEST_PYPI_MARIMO_BASE_PASSWORD }}
- run: hatch publish --repo test
+ run: uvx hatch publish --repo test
- name: 📦 Update package.json version from CLI
working-directory: frontend
diff --git a/.github/workflows/marimo-bot.yml b/.github/workflows/marimo-bot.yml
index 4e9124dbe1..2d691dc278 100644
--- a/.github/workflows/marimo-bot.yml
+++ b/.github/workflows/marimo-bot.yml
@@ -88,31 +88,32 @@ jobs:
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
- - name: 🥚 Install Hatch
- uses: pypa/hatch@install
+ - name: Install uv
+ uses: astral-sh/setup-uv@v6
- name: Adapt pyproject.toml to build marimo-base
- run: ./scripts/modify_pyproject_for_marimo_base.sh
+ run: ./scripts/modify_pyproject_for_marimo_base.py
- # patch __init__.py version to be of the form
+ # patch pyproject.toml version to be of the form
# X.Y.Z-dev9{4random digits}
# This must be a valid semver version from
# https://packaging.python.org/en/latest/discussions/versioning/
- name: 🔨 Patch version number
run: |
# Get the version number
- # - assumes version is on a line of the form __version__ == "x.y.z"
- current_version=`grep '__version__' marimo/__init__.py | awk '{print $3}' | tr -d '"'`
+ current_version=`uv version --short`
# Generate a random 4-digit number
random_digits=`shuf -i 1000-9999 -n 1`
# Form the new version with the random digits
MARIMO_VERSION="${current_version}-dev9${random_digits}"
# Set the version in the environment for later steps
echo "MARIMO_VERSION=$MARIMO_VERSION" >> $GITHUB_ENV
- sed -i "s/__version__ = \".*\"/__version__ = \"$MARIMO_VERSION\"/" marimo/__init__.py
+ uv version "$MARIMO_VERSION"
+ env:
+ NO_COLOR: 1
- name: 📦 Build marimo
- run: hatch build --clean
+ run: uv build
- name: 📦 Validate wheel under 2mb
run: ./scripts/validate_base_wheel_size.sh
@@ -121,7 +122,7 @@ jobs:
env:
HATCH_INDEX_USER: ${{ secrets.TEST_PYPI_USER }}
HATCH_INDEX_AUTH: ${{ secrets.TEST_PYPI_MARIMO_BASE_PASSWORD }}
- run: hatch publish --repo test
+ run: uvx hatch publish --repo test
- name: 📦 Update package.json version from CLI
working-directory: frontend
diff --git a/.github/workflows/release-marimo-base.yml b/.github/workflows/release-marimo-base.yml
index 3927a3ef69..6c8453597b 100644
--- a/.github/workflows/release-marimo-base.yml
+++ b/.github/workflows/release-marimo-base.yml
@@ -28,14 +28,14 @@ jobs:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- - name: 🥚 Install Hatch
- uses: pypa/hatch@install
+ - name: Install uv
+ uses: astral-sh/setup-uv@v6
- name: Adapt pyproject.toml to build marimo-base
- run: ./scripts/modify_pyproject_for_marimo_base.sh
+ run: ./scripts/modify_pyproject_for_marimo_base.py
- name: 📦 Build marimo-base
- run: hatch build --clean
+ run: uv build
- name: 📦 Validate wheel under 2mb
run: ./scripts/validate_base_wheel_size.sh
@@ -44,10 +44,10 @@ jobs:
env:
HATCH_INDEX_USER: ${{ secrets.PYPI_USER }}
HATCH_INDEX_AUTH: ${{ secrets.PYPI_MARIMO_BASE_PASSWORD }}
- run: hatch publish
+ run: uvx hatch publish
- name: 📤 Upload to TestPyPI
env:
HATCH_INDEX_USER: ${{ secrets.TEST_PYPI_USER }}
HATCH_INDEX_AUTH: ${{ secrets.TEST_PYPI_MARIMO_BASE_PASSWORD }}
- run: hatch publish --repo test
+ run: uvx hatch publish --repo test
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 01f7399e56..4a1a026cc6 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -318,24 +318,6 @@ If you use vscode, you might find the following `settings.json` useful:
}
```
-## Testing a branch from GitHub
-
-This requires `uv` to be installed. This may take a bit to install frontend dependencies and build the frontend.
-
-```bash
-MARIMO_BUILD_FRONTEND=true \
-uvx --with git+https://github.com/marimo-team/marimo.git@BRANCH_NAME \
-marimo edit
-```
-
-Additionally, you can run `marimo` from the main branch:
-
-```bash
-MARIMO_BUILD_FRONTEND=true \
-uvx --with git+https://github.com/marimo-team/marimo.git \
-marimo edit
-```
-
## Your first PR
Marimo has a variety of CI jobs that run on pull requests. All new PRs will fail until you have signed the [CLA](https://marimo.io/cla). Don't fret. You can sign the CLA by leaving a comment in the PR with text of `I have read the CLA Document and I hereby sign the CLA`
diff --git a/build_hook.py b/build_hook.py
deleted file mode 100644
index 9e1475a8ff..0000000000
--- a/build_hook.py
+++ /dev/null
@@ -1,76 +0,0 @@
-from __future__ import annotations
-
-import os
-import subprocess
-from typing import Any
-
-from hatchling.builders.hooks.plugin.interface import BuildHookInterface
-
-
-class FrontendBuildHook(BuildHookInterface[Any]):
- def initialize(self, version: str, build_data: dict[str, Any]) -> None:
- # Only build frontend if MARIMO_BUILD_FRONTEND variable exists
- MARIMO_BUILD_FRONTEND = os.getenv("MARIMO_BUILD_FRONTEND")
- if not MARIMO_BUILD_FRONTEND:
- self.app.display_debug(
- "MARIMO_BUILD_FRONTEND is not set, skipping frontend build"
- )
- return
-
- self.app.display_info(f"Build data: {str(build_data)}")
- self.app.display_info(f"Project root: {self.root}")
- self.app.display_info(f"Build dir: {self.directory}")
-
- self.app.display_info(
- "Starting frontend build process. This may take a minute..."
- )
- try:
- self._check_binary("node", "Node.js")
- self._check_binary("pnpm", "pnpm")
- self._run_frontend_build()
- except Exception as e:
- self.app.display_error(f"Frontend build failed: {e}")
- raise
-
- self.app.display_info("Frontend build completed successfully")
- return super().initialize(version, build_data)
-
- def _check_binary(self, binary: str, display_name: str) -> None:
- try:
- subprocess.run(
- [binary, "--version"],
- check=True,
- capture_output=True,
- text=True,
- )
- except FileNotFoundError:
- raise RuntimeError(
- f"{display_name} is not installed. Please install {display_name} and try again."
- ) from None
- except subprocess.CalledProcessError as e:
- raise RuntimeError(
- f"{display_name} check failed: {e.stderr}"
- ) from None
-
- def _run_frontend_build(self) -> None:
- try:
- # Uncomment to hide output
- capture_output = True
- result = subprocess.run(
- ["make", "fe"],
- check=True,
- capture_output=capture_output,
- text=True,
- cwd=self.root,
- )
- if capture_output:
- self.app.display_debug(f"Build output: {result.stdout}")
- except subprocess.CalledProcessError as e:
- self.app.display_error(f"Build script stderr: {e.stderr}")
- raise RuntimeError("Frontend build script failed") from e
-
- def clean(self, versions: list[str]) -> None:
- """Clean up build artifacts"""
- self.app.display_info("Cleaning frontend build artifacts...")
- # Add any frontend cleanup logic here if needed
- super().clean(versions)
diff --git a/marimo/__init__.py b/marimo/__init__.py
index 3befb8577e..c5e610a443 100644
--- a/marimo/__init__.py
+++ b/marimo/__init__.py
@@ -84,9 +84,8 @@ __all__ = [
"video",
"vstack",
"watch",
+ "__version__",
]
-__version__ = "0.14.13"
-
import marimo._ai as ai
import marimo._islands as islands
import marimo._runtime.watch as watch
@@ -146,3 +145,4 @@ from marimo._runtime.threads import Thread, current_thread
from marimo._save.save import cache, lru_cache, persistent_cache
from marimo._server.asgi import create_asgi_app
from marimo._sql.sql import sql
+from marimo._version import __version__
diff --git a/marimo/_ast/codegen.py b/marimo/_ast/codegen.py
index 4454e4e5cd..3d47dc403f 100644
--- a/marimo/_ast/codegen.py
+++ b/marimo/_ast/codegen.py
@@ -8,7 +8,6 @@ import sys
import textwrap
from typing import TYPE_CHECKING, Any, Literal, Optional
-from marimo import __version__
from marimo._ast.app_config import _AppConfig
from marimo._ast.cell import CellConfig, CellImpl
from marimo._ast.compiler import compile_cell
@@ -19,6 +18,7 @@ from marimo._ast.visitor import Name, VariableData
from marimo._convert.converters import MarimoConvert
from marimo._schemas.serialization import NotebookSerializationV1
from marimo._types.ids import CellId_t
+from marimo._version import __version__
if TYPE_CHECKING:
from pathlib import Path
diff --git a/marimo/_cli/cli.py b/marimo/_cli/cli.py
index 80910fe3ee..e9c82bbefe 100644
--- a/marimo/_cli/cli.py
+++ b/marimo/_cli/cli.py
@@ -12,7 +12,7 @@ from typing import Any, Optional
import click
import marimo._cli.cli_validators as validators
-from marimo import __version__, _loggers
+from marimo import _loggers
from marimo._ast import codegen
from marimo._ast.load import get_notebook_status
from marimo._cli.config.commands import config
@@ -39,6 +39,7 @@ from marimo._tutorials import (
) # type: ignore
from marimo._utils.marimo_path import MarimoPath, create_temp_notebook_file
from marimo._utils.platform import is_windows
+from marimo._version import __version__
def helpful_usage_error(self: Any, file: Any = None) -> None:
diff --git a/marimo/_cli/development/commands.py b/marimo/_cli/development/commands.py
index 1290f829a1..fb602f84ed 100644
--- a/marimo/_cli/development/commands.py
+++ b/marimo/_cli/development/commands.py
@@ -37,7 +37,6 @@ def _generate_server_api_schema() -> dict[str, Any]:
import marimo._server.models.packages as packages
import marimo._server.models.secrets as secrets
import marimo._snippets.snippets as snippets
- from marimo import __version__
from marimo._ast.cell import CellConfig, RuntimeStateType
from marimo._config.config import MarimoConfig
from marimo._messaging.cell_output import CellChannel, CellOutput
@@ -49,6 +48,7 @@ def _generate_server_api_schema() -> dict[str, Any]:
from marimo._utils.dataclass_to_openapi import (
PythonTypeToOpenAPI,
)
+ from marimo._version import __version__
# dataclass components used in websocket messages
# these are always snake_case
diff --git a/marimo/_cli/envinfo.py b/marimo/_cli/envinfo.py
index 1eac123386..8848d804d4 100644
--- a/marimo/_cli/envinfo.py
+++ b/marimo/_cli/envinfo.py
@@ -5,7 +5,7 @@ import platform
import sys
from typing import Any, Union, cast
-from marimo import __version__, _loggers
+from marimo import _loggers
from marimo._config.manager import get_default_config_manager
from marimo._utils.health import (
get_chrome_version,
@@ -14,6 +14,7 @@ from marimo._utils.health import (
get_required_modules_list,
)
from marimo._utils.versions import is_editable
+from marimo._version import __version__
LOGGER = _loggers.marimo_logger()
diff --git a/marimo/_cli/sandbox.py b/marimo/_cli/sandbox.py
index 58990a57f8..2895b68583 100644
--- a/marimo/_cli/sandbox.py
+++ b/marimo/_cli/sandbox.py
@@ -12,7 +12,7 @@ from typing import Any, Literal, Optional
import click
-from marimo import __version__, _loggers
+from marimo import _loggers
from marimo._cli.print import bold, echo, green, muted
from marimo._config.settings import GLOBAL_SETTINGS
from marimo._dependencies.dependencies import DependencyManager
@@ -22,6 +22,7 @@ from marimo._utils.inline_script_metadata import (
)
from marimo._utils.uv import find_uv_bin
from marimo._utils.versions import is_editable
+from marimo._version import __version__
LOGGER = _loggers.marimo_logger()
diff --git a/marimo/_cli/upgrade.py b/marimo/_cli/upgrade.py
index 03d6696079..efb227b2cc 100644
--- a/marimo/_cli/upgrade.py
+++ b/marimo/_cli/upgrade.py
@@ -9,7 +9,7 @@ from datetime import datetime
from typing import Any, Callable, cast
import marimo._utils.requests as requests
-from marimo import __version__ as current_version, _loggers
+from marimo import _loggers
from marimo._cli.print import echo, green, orange
from marimo._config.cli_state import (
MarimoCLIState,
@@ -17,6 +17,7 @@ from marimo._config.cli_state import (
write_cli_state,
)
from marimo._tracer import server_tracer
+from marimo._version import __version__ as current_version
FETCH_TIMEOUT = 3
diff --git a/marimo/_convert/notebook.py b/marimo/_convert/notebook.py
index 1683b0441b..019c33f76d 100644
--- a/marimo/_convert/notebook.py
+++ b/marimo/_convert/notebook.py
@@ -1,5 +1,4 @@
# Copyright 2025 Marimo. All rights reserved.
-from marimo import __version__
from marimo._schemas.notebook import (
NotebookCell,
NotebookCellConfig,
@@ -13,6 +12,7 @@ from marimo._schemas.serialization import (
NotebookSerializationV1,
)
from marimo._utils.code import hash_code
+from marimo._version import __version__
def convert_from_ir_to_notebook_v1(
diff --git a/marimo/_islands/_island_generator.py b/marimo/_islands/_island_generator.py
index 075ad956cd..317f821824 100644
--- a/marimo/_islands/_island_generator.py
+++ b/marimo/_islands/_island_generator.py
@@ -7,7 +7,7 @@ import sys
from textwrap import dedent
from typing import TYPE_CHECKING, Optional, Union, cast
-from marimo import __version__, _loggers
+from marimo import _loggers
from marimo._ast.app import App, InternalApp
from marimo._ast.app_config import _AppConfig
from marimo._ast.cell import Cell, CellConfig
@@ -18,6 +18,7 @@ from marimo._server.file_manager import AppFileManager
from marimo._server.file_router import AppFileRouter
from marimo._types.ids import CellId_t
from marimo._utils.marimo_path import MarimoPath
+from marimo._version import __version__
if sys.platform == "win32": # handling for windows
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
diff --git a/marimo/_save/stores/rest.py b/marimo/_save/stores/rest.py
index a2d14fe9e4..d8cc6f30a2 100644
--- a/marimo/_save/stores/rest.py
+++ b/marimo/_save/stores/rest.py
@@ -5,8 +5,9 @@ import urllib.error
import urllib.request
from typing import Optional
-from marimo import __version__, _loggers
+from marimo import _loggers
from marimo._save.stores.store import Store
+from marimo._version import __version__
LOGGER = _loggers.marimo_logger()
diff --git a/marimo/_server/api/endpoints/health.py b/marimo/_server/api/endpoints/health.py
index a12372b701..05b96eaa5e 100644
--- a/marimo/_server/api/endpoints/health.py
+++ b/marimo/_server/api/endpoints/health.py
@@ -8,7 +8,7 @@ from typing import TYPE_CHECKING, Any, Optional
from starlette.authentication import requires
from starlette.responses import JSONResponse, PlainTextResponse
-from marimo import __version__, _loggers
+from marimo import _loggers
from marimo._dependencies.dependencies import DependencyManager
from marimo._server.api.deps import AppState
from marimo._server.router import APIRouter
@@ -17,6 +17,7 @@ from marimo._utils.health import (
get_python_version,
get_required_modules_list,
)
+from marimo._version import __version__
if TYPE_CHECKING:
from starlette.requests import Request
diff --git a/marimo/_server/export/exporter.py b/marimo/_server/export/exporter.py
index 3a62f090ec..1e650f2daa 100644
--- a/marimo/_server/export/exporter.py
+++ b/marimo/_server/export/exporter.py
@@ -15,7 +15,7 @@ from typing import (
cast,
)
-from marimo import __version__, _loggers
+from marimo import _loggers
from marimo._ast.app import InternalApp
from marimo._ast.cell import Cell, CellImpl
from marimo._ast.names import DEFAULT_CELL_NAME, is_internal_cell_name
@@ -56,6 +56,7 @@ from marimo._utils.code import hash_code
from marimo._utils.data_uri import build_data_url
from marimo._utils.marimo_path import MarimoPath
from marimo._utils.paths import marimo_package_path
+from marimo._version import __version__
LOGGER = _loggers.marimo_logger()
diff --git a/marimo/_server/session/serialize.py b/marimo/_server/session/serialize.py
index 1488436b3d..6081c3c477 100644
--- a/marimo/_server/session/serialize.py
+++ b/marimo/_server/session/serialize.py
@@ -9,7 +9,7 @@ from dataclasses import dataclass
from pathlib import Path
from typing import TYPE_CHECKING, Any, Optional, Union, cast
-from marimo import __version__, _loggers
+from marimo import _loggers
from marimo._ast.cell_manager import CellManager
from marimo._messaging.cell_output import CellChannel, CellOutput
from marimo._messaging.errors import (
@@ -41,6 +41,7 @@ from marimo._types.ids import CellId_t
from marimo._utils.async_path import AsyncPath
from marimo._utils.background_task import AsyncBackgroundTask
from marimo._utils.lists import as_list
+from marimo._version import __version__
if TYPE_CHECKING:
from collections.abc import Iterable
diff --git a/marimo/_server/sessions.py b/marimo/_server/sessions.py
index a478abaae4..5239bc896f 100644
--- a/marimo/_server/sessions.py
+++ b/marimo/_server/sessions.py
@@ -706,7 +706,7 @@ class Session:
Overwrites the existing session view.
Mutates the existing session.
"""
- from marimo import __version__
+ from marimo._version import __version__
LOGGER.debug("Syncing session view from cache")
self.session_cache_manager = SessionCacheManager(
diff --git a/marimo/_server/templates/templates.py b/marimo/_server/templates/templates.py
index 69262dedc4..228334f3aa 100644
--- a/marimo/_server/templates/templates.py
+++ b/marimo/_server/templates/templates.py
@@ -8,7 +8,6 @@ from pathlib import Path
from textwrap import dedent
from typing import Any, Literal, Optional, Union, cast
-from marimo import __version__
from marimo._ast.app_config import _AppConfig
from marimo._config.config import MarimoConfig, PartialMarimoConfig
from marimo._convert.converters import MarimoConvert
@@ -20,6 +19,7 @@ from marimo._server.file_manager import read_css_file, read_html_head_file
from marimo._server.model import SessionMode
from marimo._server.tokens import SkewProtectionToken
from marimo._utils.versions import is_editable
+from marimo._version import __version__
MOUNT_CONFIG_TEMPLATE = "'{{ mount_config }}'"
diff --git a/marimo/_utils/requests.py b/marimo/_utils/requests.py
index 3f1978d03d..2ddc546568 100644
--- a/marimo/_utils/requests.py
+++ b/marimo/_utils/requests.py
@@ -5,7 +5,7 @@ import urllib.parse
import urllib.request
from typing import Any, Optional, Union
-from marimo import __version__
+from marimo._version import __version__
# Utility functions for making HTTP requests,
# without using the requests library or any other external dependencies.
diff --git a/marimo/_version.py b/marimo/_version.py
new file mode 100644
index 0000000000..f49c93d2fe
--- /dev/null
+++ b/marimo/_version.py
@@ -0,0 +1,10 @@
+# Copyright 2024 Marimo. All rights reserved.
+from __future__ import annotations
+
+from importlib.metadata import PackageNotFoundError, version
+
+try:
+ __version__ = version("marimo")
+except PackageNotFoundError:
+ # package is not installed
+ __version__ = "unknown"
diff --git a/third_party.txt b/marimo/third_party.txt
similarity index 100%
rename from third_party.txt
rename to marimo/third_party.txt
diff --git a/third_party_licenses.txt b/marimo/third_party_licenses.txt
similarity index 100%
rename from third_party_licenses.txt
rename to marimo/third_party_licenses.txt
diff --git a/pyproject.toml b/pyproject.toml
index fe3e9dc130..7fb770aa5d 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,11 +1,11 @@
[build-system]
-requires = ["hatchling"]
-build-backend = "hatchling.build"
+requires = ["uv_build>=0.8.3,<0.9.0"]
+build-backend = "uv_build"
[project]
name = "marimo"
+version = "0.14.13"
description = "A library for making reactive notebooks and apps"
-dynamic = ["version"]
# We try to keep dependencies to a minimum, to avoid conflicts with
# user environments;we need a very compelling reason for each dependency added.
# Dependencies should have lower bounds, which should be as loose as possible.
@@ -140,24 +140,6 @@ docs = [
[tool.hatch]
installer = "uv"
-[tool.hatch.build.hooks.custom]
-path = "build_hook.py"
-
-[tool.hatch.version]
-path = "marimo/__init__.py"
-
-[tool.hatch.build.targets.sdist]
-include = ["/marimo"]
-artifacts = ["marimo/_static/", "marimo/_lsp/", "third_party.txt", "third_party_licenses.txt"]
-exclude = ["marimo/_smoke_tests"]
-force-include = { "build_hook.py" = "build_hook.py" }
-
-[tool.hatch.build.targets.wheel]
-include = ["/marimo"]
-artifacts = ["marimo/_static/", "marimo/_lsp/", "third_party.txt", "third_party_licenses.txt"]
-exclude = ["marimo/_smoke_tests"]
-force-include = { "build_hook.py" = "build_hook.py" }
-
# Override the default uv version to use the latest version
[tool.hatch.envs.hatch-uv]
dependencies = ["uv>=0.4.17"]
@@ -305,6 +287,12 @@ dependencies = [
[tool.uv.sources]
marimo_docs = { path = "./docs", editable = true }
+[tool.uv.build-backend]
+module-name = "marimo"
+module-root = ""
+source-include = ["third_party.txt", "third_party_licenses.txt"]
+wheel-exclude = ["marimo/_smoke_tests/**"]
+
[tool.hatch.envs.docs.scripts]
build = "mkdocs build {args}"
serve = "mkdocs serve --clean {args}"
diff --git a/scripts/modify_pyproject_for_marimo_base.py b/scripts/modify_pyproject_for_marimo_base.py
new file mode 100755
index 0000000000..9718992556
--- /dev/null
+++ b/scripts/modify_pyproject_for_marimo_base.py
@@ -0,0 +1,50 @@
+#!/usr/bin/env uv run
+"""
+Python build tools generally only allow building
+one project 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
+"""
+# /// script
+# requires-python = ">=3.13"
+# dependencies = ["tomlkit"]
+#
+# [tool.uv]
+# exclude-newer = "2025-07-28T10:17:41.85442-04:00"
+# ///
+
+import pathlib
+import tomlkit
+
+
+root = pathlib.Path(__file__).parent.parent
+
+force_exclude = [
+ str(item.relative_to(root))
+ for item in (root / "marimo/_static").iterdir()
+ if item.name != "index.html"
+]
+
+with (root / "pyproject.toml").open(encoding="utf-8", mode="r") as f:
+ data = tomlkit.load(f)
+
+
+data["project"]["name"] = "marimo-base"
+build_backend = data["tool"]["uv"]["build-backend"]
+
+if "source-exclude" not in build_backend:
+ build_backend["source-exclude"] = []
+build_backend["source-exclude"].extend(force_exclude)
+
+if "wheel-exclude" not in build_backend:
+ build_backend["wheel-exclude"] = []
+build_backend["wheel-exclude"].extend(force_exclude)
+
+with (root / "pyproject.toml").open(encoding="utf-8", mode="w") as f:
+ tomlkit.dump(data, f)
+
+print("Successfully modified pyproject.toml for marimo-base build")
diff --git a/scripts/modify_pyproject_for_marimo_base.sh b/scripts/modify_pyproject_for_marimo_base.sh
deleted file mode 100755
index 40e95f126b..0000000000
--- a/scripts/modify_pyproject_for_marimo_base.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-# Python build tools generally only allow building one project
-# 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
-# Replace static artifacts with just index.html
-# TODO: this should be a more robust by handling new lines
-sed -i.bak 's/artifacts = \[.*\]/artifacts = ["marimo\/_static\/index.html"]/' pyproject.toml
-rm -rf pyproject.toml.bak
diff --git a/scripts/release.sh b/scripts/release.sh
index 7aac3974b7..e2cf612cfe 100755
--- a/scripts/release.sh
+++ b/scripts/release.sh
@@ -75,15 +75,16 @@ git pull origin main
# Run hatch version
print_step "Updating version"
-echo -e "Running: hatch version $VERSION_TYPE\n"
-hatch version $VERSION_TYPE
-NEW_VERSION=$(hatch --no-color version) # re-run to get the version
+echo -e "Running: uv version --bump $VERSION_TYPE\n"
+uv version --bump $VERSION_TYPE
+NEW_VERSION=$(NO_COLOR=1 uv version --short) # re-run to get the version
# Summary and confirmation
echo -e "\n${BOLD}Release Summary:${NC}"
echo " • New Version: $NEW_VERSION"
echo " • Files to be committed:"
-echo " - marimo/__init__.py"
+echo " - pyproject.toml"
+echo " - uv.lock"
if ! confirm "Proceed with release?"; then
print_warning "Release cancelled"
@@ -92,7 +93,8 @@ fi
# Commit version change
print_step "Committing version change"
-git add marimo/__init__.py
+git add pyproject.toml
+git add uv.lock
git commit -m "release: $NEW_VERSION"
# Push changes