diff --git a/Dockerfile b/Dockerfile index f69bcc8..dc28a47 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,41 +1,24 @@ -#======================================== -# builder layer -#======================================== -FROM python:3.13-slim AS builder - -# install uv and use system python -COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv -ENV UV_SYSTEM_PYTHON=1 - -COPY pyproject.toml pyproject.toml -COPY uv.lock uv.lock - -RUN uv export --no-dev --format requirements.txt -o /requirements.txt - -#======================================== -# final image -#======================================== FROM python:3.13-slim -# install git RUN apt-get update && \ - apt-get install -y --no-install-recommends git ca-certificates + apt-get install -y --no-install-recommends git ca-certificates && \ + rm -rf /var/lib/apt/lists/* -# install uv and use system python COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv ENV UV_SYSTEM_PYTHON=1 -# get pylock.toml from builder layer -COPY --from=builder /requirements.txt /requirements.txt +WORKDIR /app + +# Copy project metadata +COPY pyproject.toml uv.lock* ./ -# install dependencies to global python -RUN uv pip install -r /requirements.txt +# Copy CLI source +COPY launcher ./launcher -# copy application -WORKDIR /app -COPY ./launcher /app/launcher +# Install package into system python, includes "marimo-launcher" script +RUN uv pip install --system . EXPOSE 2718 -ENTRYPOINT ["python", "-m", "launcher.cli"] +ENTRYPOINT ["marimo-launcher", "run"] CMD [] diff --git a/Makefile b/Makefile index 150463b..3ee4b1f 100644 --- a/Makefile +++ b/Makefile @@ -75,18 +75,18 @@ ruff-apply: # Resolve 'fixable errors' with 'ruff' # CLI #################################### cli-test-inline-run: - uv run python -m launcher.cli \ + uv run marimo-launcher \ run \ --mount=tests/fixtures/inline_deps cli-test-reqs-txt-run: - uv run python -m launcher.cli \ + uv run marimo-launcher \ run \ --mount=tests/fixtures/static_deps_reqs_txt \ --requirements=requirements.txt cli-test-token-authenticated: - uv run python -m launcher.cli \ + uv run marimo-launcher \ run \ --mount=tests/fixtures/inline_deps \ --token="iamsecret" @@ -104,10 +104,8 @@ docker-test-run: # Test local docker container with test fixture notebook docker run \ -p "2718:2718" \ -v "$(CURDIR)/tests/fixtures:/tmp/fixtures" \ - -e NOTEBOOK_MOUNT="/tmp/fixtures" \ - -e NOTEBOOK_PATH="helloworld.py" \ - marimo-launcher:latest \ - run + -e NOTEBOOK_MOUNT="/tmp/fixtures/inline_deps" \ + marimo-launcher:latest #################################### # Terraform diff --git a/pyproject.toml b/pyproject.toml index 89321cc..83a01f8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ [project] name = "marimo-launcher" -version = "1.0.0" +version = "1.1.0" requires-python = ">=3.13" dependencies = [ @@ -31,7 +31,7 @@ line-length = 90 [tool.mypy] disallow_untyped_calls = true disallow_untyped_defs = true -exclude = ["tests/"] +exclude = ["tests/","build/"] [tool.pytest.ini_options] log_level = "INFO" @@ -95,3 +95,11 @@ max-doc-length = 90 [tool.ruff.lint.pydocstyle] convention = "google" + +[project.scripts] +marimo-launcher = "launcher.cli:cli" +mitlib-marimo-launcher = "launcher.cli:cli" + +[build-system] +requires = ["setuptools>=61"] +build-backend = "setuptools.build_meta" \ No newline at end of file diff --git a/uv.lock b/uv.lock index 67be7e7..e1ed41c 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 2 +revision = 3 requires-python = ">=3.13" [[package]] @@ -444,8 +444,8 @@ wheels = [ [[package]] name = "marimo-launcher" -version = "1.0.0" -source = { virtual = "." } +version = "1.1.0" +source = { editable = "." } dependencies = [ { name = "click" }, { name = "marimo" },