sistine 0.2.0__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sistine-0.2.0 → sistine-0.2.2}/PKG-INFO +1 -1
- {sistine-0.2.0 → sistine-0.2.2}/pyproject.toml +1 -1
- {sistine-0.2.0 → sistine-0.2.2}/src/sistine/app.py +6 -38
- {sistine-0.2.0 → sistine-0.2.2}/src/sistine/server.py +9 -4
- {sistine-0.2.0 → sistine-0.2.2}/src/sistine.egg-info/PKG-INFO +1 -1
- {sistine-0.2.0 → sistine-0.2.2}/README.md +0 -0
- {sistine-0.2.0 → sistine-0.2.2}/setup.cfg +0 -0
- {sistine-0.2.0 → sistine-0.2.2}/src/sistine/__init__.py +0 -0
- {sistine-0.2.0 → sistine-0.2.2}/src/sistine/__main__.py +0 -0
- {sistine-0.2.0 → sistine-0.2.2}/src/sistine/cli.py +0 -0
- {sistine-0.2.0 → sistine-0.2.2}/src/sistine/el.py +0 -0
- {sistine-0.2.0 → sistine-0.2.2}/src/sistine/query.py +0 -0
- {sistine-0.2.0 → sistine-0.2.2}/src/sistine.egg-info/SOURCES.txt +0 -0
- {sistine-0.2.0 → sistine-0.2.2}/src/sistine.egg-info/dependency_links.txt +0 -0
- {sistine-0.2.0 → sistine-0.2.2}/src/sistine.egg-info/entry_points.txt +0 -0
- {sistine-0.2.0 → sistine-0.2.2}/src/sistine.egg-info/requires.txt +0 -0
- {sistine-0.2.0 → sistine-0.2.2}/src/sistine.egg-info/top_level.txt +0 -0
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
import os
|
|
4
|
-
import urllib.request
|
|
5
3
|
from typing import Any, Callable
|
|
6
4
|
|
|
7
5
|
from .server import StreamlitServer
|
|
8
6
|
|
|
9
7
|
|
|
10
8
|
_PAGE = """\
|
|
11
|
-
<div class="sistine-wrap"
|
|
9
|
+
<div class="sistine-wrap">
|
|
10
|
+
<div class="sistine-overlay"></div>
|
|
12
11
|
{global_css}
|
|
13
12
|
{global_head}
|
|
14
13
|
{content}
|
|
@@ -44,40 +43,9 @@ class Sistine:
|
|
|
44
43
|
self._global_head.append(tag)
|
|
45
44
|
|
|
46
45
|
def use_tailwind(self) -> None:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
else:
|
|
51
|
-
self._global_scripts.append(
|
|
52
|
-
'<script src="https://cdn.tailwindcss.com"></script>'
|
|
53
|
-
)
|
|
54
|
-
|
|
55
|
-
def _load_tailwind_cdn(self) -> str | None:
|
|
56
|
-
cache_dir = os.path.join(os.getcwd(), ".sistine")
|
|
57
|
-
cache_path = os.path.join(cache_dir, "tailwind_cdn.js")
|
|
58
|
-
|
|
59
|
-
if os.path.exists(cache_path):
|
|
60
|
-
with open(cache_path, encoding="utf-8") as f:
|
|
61
|
-
return f"<script>{f.read()}</script>"
|
|
62
|
-
|
|
63
|
-
url = "https://cdn.tailwindcss.com"
|
|
64
|
-
os.makedirs(cache_dir, exist_ok=True)
|
|
65
|
-
import sys as _sys
|
|
66
|
-
try:
|
|
67
|
-
_sys.stderr.write(f"[sistine] Downloading Tailwind CDN ({url})...\n")
|
|
68
|
-
_sys.stderr.flush()
|
|
69
|
-
req = urllib.request.Request(url, headers={"User-Agent": "Mozilla/5.0"})
|
|
70
|
-
with urllib.request.urlopen(req, timeout=30) as resp:
|
|
71
|
-
code = resp.read().decode("utf-8")
|
|
72
|
-
with open(cache_path, "w", encoding="utf-8") as f:
|
|
73
|
-
f.write(code)
|
|
74
|
-
_sys.stderr.write(f"[sistine] Tailwind cached ({len(code)} bytes)\n")
|
|
75
|
-
_sys.stderr.flush()
|
|
76
|
-
return f"<script>{code}</script>"
|
|
77
|
-
except Exception as e:
|
|
78
|
-
_sys.stderr.write(f"[sistine] Failed to download Tailwind CDN: {e}\n")
|
|
79
|
-
_sys.stderr.flush()
|
|
80
|
-
return None
|
|
46
|
+
self._global_scripts.append(
|
|
47
|
+
'<script src="https://cdn.tailwindcss.com"></script>'
|
|
48
|
+
)
|
|
81
49
|
|
|
82
50
|
def sistine(self, path: str) -> Callable[[Callable[..., Any]], Callable[..., Any]]:
|
|
83
51
|
def decorator(fn: Callable[..., Any]) -> Callable[..., Any]:
|
|
@@ -86,7 +54,7 @@ class Sistine:
|
|
|
86
54
|
return decorator
|
|
87
55
|
|
|
88
56
|
def _reveal_script(self) -> str:
|
|
89
|
-
return "<script>(function(){var
|
|
57
|
+
return "<script>requestAnimationFrame(function(){var o=document.querySelector('.sistine-overlay');if(o)o.remove()})</script>"
|
|
90
58
|
|
|
91
59
|
def _render(self, html: str) -> str:
|
|
92
60
|
return _PAGE.format(
|
|
@@ -49,11 +49,16 @@ class StreamlitServer:
|
|
|
49
49
|
[data-testid="stAppViewContainer"] > section:first-child {padding-top: 0 !important;}
|
|
50
50
|
[data-testid="stAppDeployButton"] {display: none !important;}
|
|
51
51
|
[data-testid="stToolbar"] {display: none !important;}
|
|
52
|
-
@keyframes sistine-pulse { 0%,100%{opacity:
|
|
53
|
-
.sistine-
|
|
52
|
+
@keyframes sistine-pulse { 0%,100%{opacity:1} 50%{opacity:.9} }
|
|
53
|
+
.sistine-overlay {
|
|
54
|
+
position:fixed;inset:0;z-index:999999;
|
|
55
|
+
background:var(--sistine-loading-bg,#0f0f0f);
|
|
56
|
+
animation:sistine-pulse 1.5s ease-in-out infinite;
|
|
57
|
+
}
|
|
54
58
|
.stApp { margin: 0; padding: 0; background: transparent !important; }
|
|
55
59
|
body { margin: 0; padding: 0; }
|
|
56
|
-
|
|
60
|
+
.sistine-wrap { min-height: 100vh; }
|
|
61
|
+
.sistine-wrap, .sistine-wrap * { margin: 0; padding: 0; box-sizing: border-box; }
|
|
57
62
|
</style>
|
|
58
63
|
""",
|
|
59
64
|
unsafe_allow_html=True,
|
|
@@ -65,7 +70,7 @@ class StreamlitServer:
|
|
|
65
70
|
if not is_running_in_streamlit():
|
|
66
71
|
script = sys.argv[0]
|
|
67
72
|
print(
|
|
68
|
-
f"\n \033[1mSistine v0.2.
|
|
73
|
+
f"\n \033[1mSistine v0.2.2\033[0m — Starting Streamlit backend on http://{host}:{port}...\n"
|
|
69
74
|
)
|
|
70
75
|
|
|
71
76
|
import subprocess
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|