The BMesh moduel allows real-time visualization of meshes. It’s the same module that Blender uses to visualize orange selections + mesh updates in Edit Mode.
Normally, when you manipulate a mesh with BPY, it’ll only update in Object Mode, but not in Edit Mode. That’s because the 3D Viewport needs to be given instructions on how to display the updates - that’s what the BMesh module is for.
I made a demo of using BMesh here: