from __future__ import annotations

import re


_VERSION_PARTS = re.compile(r"\d+")


def parse_version(value: str) -> tuple[int, ...] | None:
    parts = _VERSION_PARTS.findall(value)
    if not parts:
        return None
    return tuple(int(part) for part in parts)


def is_less_than(version: str, minimum: str) -> bool:
    left = parse_version(version)
    right = parse_version(minimum)
    if left is None or right is None:
        return False

    length = max(len(left), len(right))
    left = left + (0,) * (length - len(left))
    right = right + (0,) * (length - len(right))
    return left < right
