Spaces:
Sleeping
Sleeping
Download deploy/check_runtime.py from xkailashhh/Kali3: direct link, hf CLI and curl.
- Browser
- Download file 1.18 kB
-
https://huggingface.co/spaces/xkailashhh/Kali3/resolve/main/deploy/check_runtime.py
- Command line
-
hf download hf://spaces/xkailashhh/Kali3/deploy/check_runtime.py
-
curl -L -o check_runtime.py https://huggingface.co/spaces/xkailashhh/Kali3/resolve/main/deploy/check_runtime.py
1.18 kB
| #!/usr/bin/env python3 | |
| """Fail before opening live state if this interpreter uses unsafe SQLite.""" | |
| from __future__ import annotations | |
| import sqlite3 | |
| import sys | |
| MIN_SQLITE = (3, 51, 3) | |
| def check_sqlite() -> None: | |
| if sqlite3.sqlite_version_info < MIN_SQLITE: | |
| raise RuntimeError( | |
| f"HF startup blocked: {sys.executable} loads SQLite {sqlite3.sqlite_version}; " | |
| "SQLite >=3.51.3 is required. Rebuild with the fixed system Python; " | |
| "a system-python check alone does not validate the application venv." | |
| ) | |
| with sqlite3.connect(":memory:") as db: | |
| db.execute("CREATE VIRTUAL TABLE docs USING fts5(content, tokenize='trigram')") | |
| db.execute("INSERT INTO docs VALUES ('hermes')") | |
| if db.execute("SELECT count(*) FROM docs WHERE docs MATCH 'erm'").fetchone()[0] != 1: | |
| raise RuntimeError("HF startup blocked: application SQLite FTS5 trigram check failed") | |
| if __name__ == "__main__": | |
| try: | |
| check_sqlite() | |
| except Exception as exc: | |
| print(str(exc), file=sys.stderr) | |
| raise SystemExit(1) | |
| print(f"HF SQLite verified: {sys.executable} uses {sqlite3.sqlite_version}") | |