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

Support iPython #702

Open
gergelyk opened this issue Oct 11, 2020 · 4 comments
Open

Support iPython #702

gergelyk opened this issue Oct 11, 2020 · 4 comments

Comments

@gergelyk
Copy link

Among supported languages you may consider iPython, because of its great integration with shell. E.g.:

rename_to_lower_case:
    #!/usr/bin/env python3
    items = !ls
    for i in items: 
        u = i.lower() 
        !mv $i $u 

Hint: ipython executable accepts extended syntax if name of the script ends with .ipy suffix, e.g. ipython myscript.ipy.

@casey
Copy link
Owner

casey commented Oct 11, 2020

Ah, interesting. Just will copy the script to some temporary file without any extension. Is there any alternative way to get ipython to accept extended syntax? Like:

rename_to_lower_case:
    #!/usr/bin/env ipython --extended-syntax
    items = !ls
    for i in items: 
        u = i.lower() 
        !mv $i $u 

@gergelyk
Copy link
Author

I'm afraid there is no such option available at the moment.

@casey
Copy link
Owner

casey commented Oct 11, 2020

If #604 (recipe annotations) were added, then a recipe annotation could be added to tell Just what file extension it should use to when creates the executable version of a shebang recipe:

#[extension = "ipy"]
rename_to_lower_case:
    #!/usr/bin/env ipython --extended-syntax
    items = !ls
    for i in items: 
        u = i.lower() 
        !mv $i $u 

Another possibility is to get ipython to add a flag that allows turning on extended syntax, which I think would be a good feature anyways.

@gergelyk
Copy link
Author

Issue to IPython submitted. I like the idea with annotations.

Note that some versions of /usr/bin/env need -S flag if we need to provide extra parameters to the command. E.g. in my case this doesn't work as a script:

#!/usr/bin/env just -f

build:
  g++ main.cpp

run: build
  ./a.out

but this works fine:

#!/usr/bin/env -S just -f

build:
  g++ main.cpp

run: build
  ./a.out

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

No branches or pull requests

2 participants