Spaces:
Sleeping
Sleeping
fix rtc example
Browse files- .python-version +1 -0
- Dockerfile +10 -41
- README.md +16 -2
- pyproject.toml +21 -0
- requirements.txt +0 -10
.python-version
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
3.12
|
Dockerfile
CHANGED
@@ -1,53 +1,22 @@
|
|
1 |
FROM python:3.12
|
2 |
|
3 |
-
COPY --from=ghcr.io/astral-sh/uv:0.
|
4 |
-
RUN set -ex \
|
5 |
-
&& chmod 755 /bin/uv \
|
6 |
-
&& useradd --create-home --shell /bin/bash --uid 1000 user
|
7 |
|
8 |
# Set environment variables
|
9 |
ENV VIRTUAL_ENV=/opt/venv \
|
10 |
-
PATH="/opt/venv/bin
|
11 |
-
HOME=/home/user
|
12 |
|
13 |
-
#
|
14 |
-
|
15 |
-
RUN uv venv $VIRTUAL_ENV \
|
16 |
-
&& uv pip install --no-cache-dir -r requirements.txt \
|
17 |
-
&& chown -R user:user $VIRTUAL_ENV
|
18 |
-
|
19 |
-
# Create directories and set permissions
|
20 |
-
RUN mkdir -p $HOME/.cache $HOME/.config /data \
|
21 |
-
&& chown -R user:user $HOME /data \
|
22 |
-
&& chmod -R 755 $HOME /data \
|
23 |
-
&& chown -R user:user /opt/venv
|
24 |
-
|
25 |
-
RUN --mount=type=secret,id=MARIMO_PASSWORD \
|
26 |
-
cat /run/secrets/MARIMO_PASSWORD > $HOME/.marimo_password \
|
27 |
-
&& chmod 600 $HOME/.marimo_password \
|
28 |
-
&& chown user:user $HOME/.marimo_password
|
29 |
|
30 |
# Set working directory
|
31 |
WORKDIR /data
|
32 |
|
33 |
-
#
|
34 |
-
COPY
|
35 |
-
|
36 |
-
# Set user
|
37 |
-
USER user
|
38 |
-
|
39 |
-
# Use heredoc with explicit delimiter
|
40 |
-
RUN <<'ENDCONFIG' cat > $HOME/.marimo.toml
|
41 |
-
[package_management]
|
42 |
-
manager = "uv"
|
43 |
-
|
44 |
-
[display]
|
45 |
-
cell_output = "below"
|
46 |
-
dataframes = "rich"
|
47 |
-
theme = "light"
|
48 |
-
ENDCONFIG
|
49 |
|
|
|
|
|
50 |
|
51 |
-
|
52 |
-
# CMD marimo edit /data --host=0.0.0.0 --port=7860 --token-password=$(cat $HOME/.marimo_password)
|
53 |
-
CMD marimo edit /data --host=0.0.0.0 --port=7860 --no-token
|
|
|
1 |
FROM python:3.12
|
2 |
|
3 |
+
COPY --from=ghcr.io/astral-sh/uv:0.7.3 /uv /uvx /bin/
|
|
|
|
|
|
|
4 |
|
5 |
# Set environment variables
|
6 |
ENV VIRTUAL_ENV=/opt/venv \
|
7 |
+
PATH="/opt/venv/bin:$PATH"
|
|
|
8 |
|
9 |
+
# Create directories
|
10 |
+
RUN mkdir -p /data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
# Set working directory
|
13 |
WORKDIR /data
|
14 |
|
15 |
+
# Install dependencies using uv and pyproject.toml
|
16 |
+
COPY ./pyproject.toml ./pyproject.toml
|
17 |
+
RUN uv sync
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
+
# Copy examples
|
20 |
+
COPY ./examples ./examples
|
21 |
|
22 |
+
CMD ["uv", "run", "marimo", "edit", "/data", "--host", "0.0.0.0", "--port", "7860", "--no-token"]
|
|
|
|
README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
---
|
2 |
-
title: marimo
|
3 |
-
emoji:
|
4 |
colorFrom: yellow
|
5 |
colorTo: blue
|
6 |
sdk: docker
|
@@ -11,3 +11,17 @@ short_description: A marimo Space to edit marimo notebooks
|
|
11 |
|
12 |
Check out marimo at <https://github.com/marimo-team/marimo>
|
13 |
Check out the configuration reference at <https://huggingface.co/docs/hub/spaces-config-reference>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
title: marimo rtc
|
3 |
+
emoji: 🎮
|
4 |
colorFrom: yellow
|
5 |
colorTo: blue
|
6 |
sdk: docker
|
|
|
11 |
|
12 |
Check out marimo at <https://github.com/marimo-team/marimo>
|
13 |
Check out the configuration reference at <https://huggingface.co/docs/hub/spaces-config-reference>
|
14 |
+
|
15 |
+
## Development
|
16 |
+
|
17 |
+
### Build the docker image
|
18 |
+
|
19 |
+
```bash
|
20 |
+
docker build -t marimo-rtc .
|
21 |
+
```
|
22 |
+
|
23 |
+
### Run the docker container
|
24 |
+
|
25 |
+
```bash
|
26 |
+
docker run -p 7860:7860 marimo-rtc
|
27 |
+
```
|
pyproject.toml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[project]
|
2 |
+
dependencies = [
|
3 |
+
"marimo[sql,recommended,lsp]",
|
4 |
+
"huggingface-hub==0.26.2",
|
5 |
+
]
|
6 |
+
description = "marimo rtc example"
|
7 |
+
name = "marimo-rtc"
|
8 |
+
readme = "README.md"
|
9 |
+
requires-python = ">=3.12"
|
10 |
+
version = "0.1.0"
|
11 |
+
|
12 |
+
[tool.marimo.package_management]
|
13 |
+
manager = "uv"
|
14 |
+
|
15 |
+
[tool.marimo.display]
|
16 |
+
cell_output = "below"
|
17 |
+
dataframes = "rich"
|
18 |
+
theme = "light"
|
19 |
+
|
20 |
+
[tool.marimo.experimental]
|
21 |
+
rtc_v2 = true
|
requirements.txt
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
huggingface-hub==0.26.2
|
2 |
-
marimo[sql]
|
3 |
-
polars
|
4 |
-
altair
|
5 |
-
openai
|
6 |
-
pyarrow
|
7 |
-
# Or a specific version
|
8 |
-
# marimo>=0.9.0
|
9 |
-
|
10 |
-
# Add other dependencies as needed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|