@superlopuh and I had a whiteboarding session last week where we discussed an easy way to translate Python source assignment semantics to MLIR, we've decided on using the symref dialect.
Problem: Python assignments do not follow SSA form, MLIR does.
Solution: map all assignments to symref, and appropiate fetch/update for assignment and load respectively. For symref.declare, this requires a little trick not so well known in Python land: function-scoped locals are actually pre-determined at Python bytecode compilation time, so we can use that to declare all known variables at the start of the function first.
I'm going to work on this soon.