Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically add shebang #1149

Open
txoof opened this issue Oct 29, 2023 · 5 comments
Open

Automatically add shebang #1149

txoof opened this issue Oct 29, 2023 · 5 comments

Comments

@txoof
Copy link

txoof commented Oct 29, 2023

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 #914 (comment)_

@mwouts
Copy link
Owner

mwouts commented Nov 3, 2023

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:
image

@txoof
Copy link
Author

txoof commented Nov 12, 2023

@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.

@mwouts
Copy link
Owner

mwouts commented Nov 12, 2023

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.

@txoof
Copy link
Author

txoof commented Nov 15, 2023

@mwouts Thanks! Jupytext has revolutionized my workflow. I really love this tool!

@mwouts
Copy link
Owner

mwouts commented Nov 16, 2023

Glad you like it! Thank you for your kind works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants