I need to configure the behavior of elpy when editing a python src block in org-src-mode. Usually such configuration code should be added to org-src-mode-hook. In my code I need to check some header args and act appropriately: I need to make sure that the code is python (not, say ipython) and whether the :session parameter is set.
The only way I found to do this is to access a "private" and undocumented variable org-src--babel-info. Is this the suggested way? Should this be documented in org-mode?
In particular my default elpy iterpreter is jupyter but I need to set it to python when editing src code blocks and I need elpy to use the running session when pressing C-c C-c instead of opening a new one.
org-element-mapandorg-element-propertyfunctions to extract the header info? I suspect these functions would work but I’m still trying understand how to pass the header data back to hook.