scripting: Modifying an object in edit mode
Okay, I forgot to select all the mesh after toggling to edit mode:

it's working now:

from math import pi
import bpy

obj = bpy.data.objects['my_obj']
# go into edit mode
bpy.context.scene.objects.active = obj
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.transform.rotate(value=pi/2, axis=(False, False, True))
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)