Skip to content

Commit 3a02f05

Browse files
change narwhals
1 parent bb79e58 commit 3a02f05

File tree

3 files changed

+85
-4
lines changed

3 files changed

+85
-4
lines changed

.github/workflows/publish-marimo.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Publish Marimo Notebooks
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
paths:
7+
- '**/*.py' # Trigger on Python file changes
8+
workflow_dispatch: # Allow manual triggering
9+
10+
jobs:
11+
build-and-deploy:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v3
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: '3.9'
21+
cache: 'pip'
22+
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install marimo
27+
# Install any other dependencies needed by your notebooks
28+
pip install pandas numpy polars
29+
30+
- name: Find and export marimo notebooks
31+
run: |
32+
mkdir -p _site
33+
34+
# Find all marimo notebooks (Python files with marimo imports)
35+
MARIMO_FILES=$(grep -l "import marimo" $(find . -name "*.py" ! -path "./venv/*" ! -path "./.github/*") || echo "")
36+
37+
if [ -z "$MARIMO_FILES" ]; then
38+
echo "No marimo notebooks found."
39+
exit 0
40+
fi
41+
42+
# Export each notebook to HTML
43+
for file in $MARIMO_FILES; do
44+
echo "Processing $file"
45+
# Extract directory and filename
46+
filename=$(basename "$file" .py)
47+
directory=$(dirname "$file")
48+
output_dir="_site/${directory#./}"
49+
50+
# Create output directory
51+
mkdir -p "$output_dir"
52+
53+
# Export to HTML
54+
marimo export "$file" --format html --output "$output_dir/$filename.html"
55+
56+
# If this is in the root directory, create a copy for easy access
57+
if [ "$directory" = "." ]; then
58+
cp "$output_dir/$filename.html" "_site/$filename.html"
59+
fi
60+
done
61+
62+
# Create an index.html that lists all exported notebooks
63+
echo "<html><head><title>Marimo Notebooks</title><style>body{font-family:sans-serif;max-width:800px;margin:0 auto;padding:20px}h1{color:#0066cc}ul{list-style-type:none;padding:0}li{margin:10px 0;padding:10px;border:1px solid #eee;border-radius:5px}a{color:#0066cc;text-decoration:none}a:hover{text-decoration:underline}</style></head><body><h1>Marimo Notebooks</h1><ul>" > _site/index.html
64+
65+
find _site -name "*.html" ! -name "index.html" | sort | while read notebook; do
66+
rel_path="${notebook#_site/}"
67+
name=$(basename "$notebook" .html)
68+
dir=$(dirname "$rel_path")
69+
if [ "$dir" = "." ]; then
70+
dir="Root"
71+
fi
72+
echo "<li><strong>$dir/</strong> <a href=\"$rel_path\">$name</a></li>" >> _site/index.html
73+
done
74+
75+
echo "</ul></body></html>" >> _site/index.html
76+
77+
- name: Deploy to GitHub Pages
78+
uses: JamesIves/github-pages-deploy-action@v4
79+
with:
80+
folder: _site
81+
branch: gh-pages

data_science_tools/narwhals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def _(mo):
7171
- It doesn't return to the user the same class they started with.
7272
- It kills lazy execution.
7373
- It kills GPU acceleration.
74-
- If forces pandas as a required dependency.
74+
- If forces pandas as a required dependency
7575
"""
7676
)
7777
return

0 commit comments

Comments
 (0)