We now have the command
Jupyter: Export Current Python File as Jupyter Notebook
accessible from the command palette or the editor context menu, which works like a charm for files with code cell (#%%) annotations.