This isn't the exact answer but it helps.
Uploading without avrdude is complicated and generally slow. The best solution to not using the IDE is to open and close a port then use the avrdude command that the ide usually uses.
from serial import Serial
from time import sleep
from subprocess import run
while input('Press enter to upload ') == '':
Serial('COM5',baudrate=1200).close()
sleep(1)
run(["C:\\Progra~2\\Arduino\\hardware\\tools\\avr/bin/avrdude", "-CC:\\Progra~2\\Arduino\\hardware\\tools\\avr/etc/avrdude.conf", "-v", "-patmega32u4", "-cavr109", "-PCOM6", "-b57600", "-D", "-Uflash:w:C:\\Users\\Hedengren\\Desktop\\Python\\tclab_v2\\Users\\USER\\Desktop\\Python\\tclab_v2/tclab_v2.ino.hex:i"])