nexu-io/open-design · error · SystemExit

last30days v3 requires Python 3.12+. Detected Python {major}

Error message

last30days v3 requires Python 3.12+.
Detected Python {major}.{minor}.{micro}.
Install and use python3.12 or python3.13, then rerun this command.

What it means

last30days v3 uses Python 3.12+ syntax (PEP 604 unions in type hints, tuple[int,int,int] generics). ensure_supported_python() runs at import time (module top-level) and compares sys.version_info against MIN_PYTHON; on an older interpreter it writes a multi-line stderr message and raises SystemExit(1) before any other code can fail with an opaque SyntaxError. The message names python3.12 / python3.13 explicitly because those are the validated targets.

Source

Thrown at design-templates/last30days/scripts/last30days.py:31

import sys
import threading
from pathlib import Path

MIN_PYTHON = (3, 12)


def ensure_supported_python(version_info: tuple[int, int, int] | object | None = None) -> None:
    if version_info is None:
        version_info = sys.version_info
    major, minor, micro = tuple(version_info[:3])
    if (major, minor) >= MIN_PYTHON:
        return
    sys.stderr.write(
        "last30days v3 requires Python 3.12+.\n"
        f"Detected Python {major}.{minor}.{micro}.\n"
        "Install and use python3.12 or python3.13, then rerun this command.\n"
    )
    raise SystemExit(1)


ensure_supported_python()

if os.name == "nt":
    for stream in (sys.stdout, sys.stderr):
        if hasattr(stream, "reconfigure"):
            stream.reconfigure(encoding="utf-8", errors="replace")

SCRIPT_DIR = Path(__file__).parent.resolve()
sys.path.insert(0, str(SCRIPT_DIR))

from lib import env, html_render, pipeline, render, schema, ui

_child_pids: set[int] = set()
_child_pids_lock = threading.Lock()

View on GitHub (pinned to 5be4028344)

Solutions

  1. Install Python 3.12 or 3.13 (`brew install python@3.12`, `pyenv install 3.13`, or use the official installer).
  2. Invoke the script with the explicit interpreter: `python3.12 last30days.py ...` instead of `python last30days.py`.
  3. If using a venv, recreate it from the new interpreter: `python3.12 -m venv .venv && source .venv/bin/activate`.
  4. In CI, set the image/setup-python action to 3.12.x or 3.13.x.
  5. Verify with `python3.12 --version` before rerunning the command.

Example fix

# before
python last30days.py --topic "rust gui frameworks"
# after
python3.12 last30days.py --topic "rust gui frameworks"
# or pin a venv
python3.12 -m venv .venv && . .venv/bin/activate
python last30days.py --topic "rust gui frameworks"
Defensive patterns

Strategy: validation

Validate before calling

# Check before delegating to last30days.
import sys
MIN_PYTHON = (3, 12)
if sys.version_info < MIN_PYTHON:
    sys.exit(f"python {'.'.join(map(str, MIN_PYTHON))}+ required, got {sys.version_info[0]}.{sys.version_info[1]}")

Try / catch

import subprocess, sys
try:
    subprocess.run([sys.executable, 'last30days.py', '--topic', 'x'], check=True)
except SystemExit as e:
    if e.code == 1:
        print('last30days needs Python 3.12+; rerun with python3.12', file=sys.stderr)
    raise

Prevention

When it happens

Trigger: Executing `last30days.py` (or any module that imports it) with a Python interpreter whose (major, minor) is below MIN_PYTHON — e.g. `python3.11 last30days.py`, `python last30days.py` on a system where `python` is 3.10, or running via a venv built on an older runtime.

Common situations: macOS default `python3` still on 3.9/3.11 from Xcode CLT; a CI image pinned to python3.11; a pyenv shim resolving to an older version; a packaged/runner environment that ignores .python-version.

Related errors


AI-assisted analysis of nexu-io/open-design@5be4028344 (2026-08-12). Data as JSON: /api/errors/9e72128f4eeb2682. Report an issue: GitHub.