jupytext
jupytext copied to clipboard
Automatically add shebang
Is there a way to add the shebang to projects that start from within Jupyter? I can't find a way other than running:
!jupytext Untitled.ipynb --update-metadata '{"jupytext":{"executable":"/usr/bin/python"}}' --to py
from within the notebook to do this.
This works, but is rather convoluted and requires some non-intuitive commands; this seems rather contrary to the ease of the rest of jupytext. The method above also causes the Reload/Cancel/Overwrite dialogue to pop up.
Related comment from @mwouts in https://github.com/mwouts/jupytext/issues/914#issuecomment-1032934480_
Hi @txoof , well I don't think there is any other programmatic way to do this, but if you prefer you could directly edit the notebook metadata, like in this screenshot:
@mwouts
Thanks for the suggestion. That definitely works. It just feels hacky for such an otherwise comprehensive tool that does everything else almost magically.
I guess I'll migrate this to a feature request.
Thanks 😊
I will think about this.
Maybe we could let users configure a default shebang or, more generally, a default metadata through the Jupytex configuration file.
These weeks, we are finishing Jupytext 1.16, which will improve the user experience in JLab 4, I will come back to this afterwards.
@mwouts Thanks! Jupytext has revolutionized my workflow. I really love this tool!
Glad you like it! Thank you for your kind works.