jupytext completely solves this problem. Agree about the no hidden state comment from above however -- that's a source of constant footguns for us.