| 123456789101112131415161718192021222324252627282930313233343536 |
- """Check the local interpreter and standard library, without reading .env."""
- import hashlib
- import argparse
- import sqlite3
- import ssl
- import sys
- from pathlib import Path
- def main():
- if sys.version_info < (3, 14):
- raise RuntimeError("Python >=3.14 is required by this project")
- import tomllib
- root = Path(__file__).resolve().parents[1]
- parser = argparse.ArgumentParser(description=__doc__)
- parser.add_argument('--environment', type=Path, default=root / '.venv')
- args = parser.parse_args()
- if Path(sys.prefix).resolve() != args.environment.resolve():
- raise RuntimeError("Unexpected virtual environment interpreter")
- with (root / "pyproject.toml").open("rb") as source:
- project = tomllib.load(source)["project"]
- if project["name"] != "business-assistant":
- raise RuntimeError("Unexpected project metadata")
- hashlib.sha256(b"runtime-smoke").hexdigest()
- with sqlite3.connect(":memory:") as connection:
- if connection.execute("select 1").fetchone() != (1,):
- raise RuntimeError("SQLite smoke check failed")
- if not ssl.OPENSSL_VERSION:
- raise RuntimeError("SSL runtime is unavailable")
- print(f"Python {sys.version.split()[0]} runtime smoke passed: local venv, TOML, SSL, SQLite, SHA256.")
- if __name__ == "__main__":
- main()
|