import hashlib


def sha256_checksum(path: str, chunk_size: int = 4*1024*1024):
    """
    Computes the sha256 checksum on the file in given path.

    Args:
        path: The file to compute the sha256 checksum for.
        chunk_size: Chunk size to read per time, prevents loading the full file
            into memory (default 4MiB).

    Returns:
        The sha256 checksum hex digest as a string.
    """
    hash_sha256 = hashlib.sha256()
    with open(path, "rb") as f:
        for chunk in iter(lambda: f.read(chunk_size), b""):
            hash_sha256.update(chunk)
    return hash_sha256.hexdigest()