migrate bundle generation to python