sistine 0.2.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sistine
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: HTML builder with server routing for Python
5
5
  Author: Ararya Arka Anugraha
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "sistine"
7
- version = "0.2.1"
7
+ version = "0.2.2"
8
8
  description = "HTML builder with server routing for Python"
9
9
  authors = [
10
10
  {name = "Ararya Arka Anugraha"},
@@ -1,7 +1,5 @@
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
@@ -45,40 +43,9 @@ class Sistine:
45
43
  self._global_head.append(tag)
46
44
 
47
45
  def use_tailwind(self) -> None:
48
- script = self._load_tailwind_cdn()
49
- if script:
50
- self._global_scripts.append(script)
51
- else:
52
- self._global_scripts.append(
53
- '<script src="https://cdn.tailwindcss.com"></script>'
54
- )
55
-
56
- def _load_tailwind_cdn(self) -> str | None:
57
- cache_dir = os.path.join(os.getcwd(), ".sistine")
58
- cache_path = os.path.join(cache_dir, "tailwind_cdn.js")
59
-
60
- if os.path.exists(cache_path):
61
- with open(cache_path, encoding="utf-8") as f:
62
- return f"<script>{f.read()}</script>"
63
-
64
- url = "https://cdn.tailwindcss.com"
65
- os.makedirs(cache_dir, exist_ok=True)
66
- import sys as _sys
67
- try:
68
- _sys.stderr.write(f"[sistine] Downloading Tailwind CDN ({url})...\n")
69
- _sys.stderr.flush()
70
- req = urllib.request.Request(url, headers={"User-Agent": "Mozilla/5.0"})
71
- with urllib.request.urlopen(req, timeout=30) as resp:
72
- code = resp.read().decode("utf-8")
73
- with open(cache_path, "w", encoding="utf-8") as f:
74
- f.write(code)
75
- _sys.stderr.write(f"[sistine] Tailwind cached ({len(code)} bytes)\n")
76
- _sys.stderr.flush()
77
- return f"<script>{code}</script>"
78
- except Exception as e:
79
- _sys.stderr.write(f"[sistine] Failed to download Tailwind CDN: {e}\n")
80
- _sys.stderr.flush()
81
- return None
46
+ self._global_scripts.append(
47
+ '<script src="https://cdn.tailwindcss.com"></script>'
48
+ )
82
49
 
83
50
  def sistine(self, path: str) -> Callable[[Callable[..., Any]], Callable[..., Any]]:
84
51
  def decorator(fn: Callable[..., Any]) -> Callable[..., Any]:
@@ -87,7 +54,7 @@ class Sistine:
87
54
  return decorator
88
55
 
89
56
  def _reveal_script(self) -> str:
90
- return "<script>(function(){var o=document.querySelector('.sistine-overlay');if(o)o.remove()})()</script>"
57
+ return "<script>requestAnimationFrame(function(){var o=document.querySelector('.sistine-overlay');if(o)o.remove()})</script>"
91
58
 
92
59
  def _render(self, html: str) -> str:
93
60
  return _PAGE.format(
@@ -57,7 +57,8 @@ class StreamlitServer:
57
57
  }
58
58
  .stApp { margin: 0; padding: 0; background: transparent !important; }
59
59
  body { margin: 0; padding: 0; }
60
- * { margin: 0; padding: 0; box-sizing: border-box; }
60
+ .sistine-wrap { min-height: 100vh; }
61
+ .sistine-wrap, .sistine-wrap * { margin: 0; padding: 0; box-sizing: border-box; }
61
62
  </style>
62
63
  """,
63
64
  unsafe_allow_html=True,
@@ -69,7 +70,7 @@ class StreamlitServer:
69
70
  if not is_running_in_streamlit():
70
71
  script = sys.argv[0]
71
72
  print(
72
- f"\n \033[1mSistine v0.2.1\033[0m — Starting Streamlit backend on http://{host}:{port}...\n"
73
+ f"\n \033[1mSistine v0.2.2\033[0m — Starting Streamlit backend on http://{host}:{port}...\n"
73
74
  )
74
75
 
75
76
  import subprocess
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sistine
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: HTML builder with server routing for Python
5
5
  Author: Ararya Arka Anugraha
6
6
  License-Expression: MIT
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes