def parse_version(version: str) ->tuple:
    """Parse a string formatted X[.Y.Z] version number into a tuple

    >>> parse_version('10.2.3')
    (10, 2, 3)

    >>> parse_version('12')
    (12, 0, 0)
    """
    parts = version.split('.')
    missing = 3 - len(parts)
    return tuple(map(int, parts + ['0'] * missing))
