def comma_list_to_shape(s):
    """Parse a string of comma-separated ints into a valid numpy shape.

    Trailing commas will raise an error.

    Parameters
    ----------
    s : str
        A string of comma-separated positive integers.

    Returns
    -------
    tuple
    """
    if not isinstance(s, str):
        raise TypeError("s must be a string")
    if s == "":
        raise ValueError("s is empty")
    # split by comma into an array of strings and try to convert to int
    shape = tuple(map(int, s.split(",")))
    # check that each shape member is valid (positive int), return if valid
    for i in range(len(shape)):
        if shape[i] < 1:
            raise ValueError(f"axis {i} of shape {shape} must be positive")
    return shape