← Files Codex SecurityARCHIVED FILE

scripts/workbench/runtime_toml.py

802 Bytes · Nov 18, 2026 · 06:11 UTC

↓ Download file

See the change to this file →

"""Expose tomllib to workbench callers, using tomli on Python 3.10.

Import exits with setup guidance when the runtime is too old or the backport is missing.
"""

import sys

__all__ = ["tomllib"]

if sys.version_info < (3, 10):
    raise SystemExit(
        "Codex Security requires Python 3.10 or later. Update the Codex managed runtime "
        "or set PYTHON to a supported interpreter, then restart Codex."
    )

try:
    import tomllib as tomllib
except ModuleNotFoundError:  # Python 3.10
    try:
        import tomli as tomllib
    except ModuleNotFoundError as exc:
        raise SystemExit(
            "Codex Security requires tomli with Python 3.10. Install tomli for the selected "
            "interpreter or set PYTHON to Python 3.11 or later, then restart Codex."
        ) from exc

SHA-256: 119fe79d8ecf4feedd5f17be578b9a84b3c2b450b36fed058b5aa2cb64c750e8