Replies: 23 comments
-
Note that Python notebooks allow a one line execution using unix shell, e.g.
Just to note people will complain about the two-line ceremony needed to get to the shell. We can deal with that question as orthogonal to the basics of getting bash scripting in place |
Beta Was this translation helpful? Give feedback.
-
I'm not sure we can easily support I am interested, however, in adding some kind of 'native shell' experience that might default to bash on Linux/MacOS (or the user's default shell?) and CMD on Windows. I'm not sure what the language specifier should be; perhaps
would only work on Linux/MacOS while
would only work on Windows. |
Beta Was this translation helpful? Give feedback.
-
I think the problem with a "default shell" language is that it won't work cross-platform. Shell-specific magic commands like We haven't got a working example yet of adding a new subkernel via a NuGet extension but it should work in theory. I'll get back with an example. |
Beta Was this translation helpful? Give feedback.
-
If you could make it that I believe a very short one line syntax is simply necessary to be cognitively competitive with Jupyter+python. People do an awful lot with
would be enough but I'm sure you'll get people asking for just |
Beta Was this translation helpful? Give feedback.
-
As part of this you should likely reserve lines beginning with Speaking of which, how do you know what the default language for the cells of a notebook is? |
Beta Was this translation helpful? Give feedback.
-
Are you suggesting reserving these magic commands and acquiring the shell-specific extensions on the fly via NuGet? Definitely doable. |
Beta Was this translation helpful? Give feedback.
-
That said, within .NET Interactive, The default language for a notebook is mapped to the kernel name, which is why in Jupyter we install three different "kernels". The difference between them is just the command line arguments to > dotnet interactive jupyter --default-kernel fsharp /path/to/connectionfile |
Beta Was this translation helpful? Give feedback.
-
I can sympathize with wanting a magic command for running a command in the shell that's available on the system. @dsyme I'm sure your example is a bit of a simplification of something much larger... but That is to say
uses the actual But yeah a way to invoke one-off commands in whatever the default shell is would be nice. The only thing we need to be careful is the feature creep because PowerShell support is more than just a shell/one off commands - you get plotting, and get/set variables from other languages, and other rich features of .NET Interactive. |
Beta Was this translation helpful? Give feedback.
-
To expand on what @TylerLeonhardt is saying, |
Beta Was this translation helpful? Give feedback.
-
Yes, that's the suggestion
That would be perfect |
Beta Was this translation helpful? Give feedback.
-
I am for the first time playing with dotnet interactive notebooks, and I was trying to figure out how I can use I guess when you use Now consider a unix script:
Linux kernel looks at this file and sees the .NET interactive could do something similar. When the identifier after @jonsequitur @dsyme @TylerLeonhardt @SteveL-MSFT @brettfo wdyt? |
Beta Was this translation helpful? Give feedback.
-
A number of the suggestions in this issue will work, but what's the best approach to making them also work on Windows? Something we've done for SQL was to add a Could something like this work for |
Beta Was this translation helpful? Give feedback.
-
@jonsequitur part of what I'm suggesting is not to limit this approach to
I'm not familiar with how this stuff works on Windows. afaik Anyway, I think it makes sense that if some well known programs like |
Beta Was this translation helpful? Give feedback.
-
Maybe there is a desire to make environment variables flow from one bash code section to the next? |
Beta Was this translation helpful? Give feedback.
-
For PowerShell we get persistent session support via |
Beta Was this translation helpful? Give feedback.
-
PowerShell can call the bash executable.
works today. alternatively, .NET Interactive could maintain a |
Beta Was this translation helpful? Give feedback.
-
It is possible to set up an exit hook that communicates back to the host process. Something like: #!/bin/bash
function at_exit {
printenv -0 >&3
}
trap at_exit EXIT |
Beta Was this translation helpful? Give feedback.
-
I chatted a bit offline with @jonsequitur about this and suggested looking at how Jupyter does this today where they have an API for turning REPLs into Jupyter Kernels: https://jupyter-client.readthedocs.io/en/stable/wrapperkernels.html The logic for the process wrapping might be able to be reused but going down this way will give the users the ability to pick any shell they'd like (as long as someone crafted a subkernel that uses this wrapper API). Could even have a Python REPL Subkernel in .NET Interactive. Or Node.js 😅 I believe they assume that you have the executable on the file system/in the PATH already. |
Beta Was this translation helpful? Give feedback.
-
I'm one of the people @dsyme predicted will be asking for |
Beta Was this translation helpful? Give feedback.
-
A one-liner of some sort should be possible. To summarize where we are:
Thoughts? Other ideas? |
Beta Was this translation helpful? Give feedback.
-
Hi, I was looking for shell scripting support for .NET interactive too. In my case I was especially looking for a way to insert "shell script" blocks instead of "one-line" statements via something like IMHO it would be fine if we had multiple implementations for multiple shells. For example, one default On the other hand, something like |
Beta Was this translation helpful? Give feedback.
-
@jonsequitur @TylerLeonhardt Hello! A few projects that I have worked with notebooks on have expressed a lot of good support for using .NET Interactive with Polyglot notebooks but one of the major blockers to fully implementing with them is that bash is not supported. Has there been any continued development or discussion around this? Thanks! |
Beta Was this translation helpful? Give feedback.
-
If bash could be added and integrated into the .NET Interactive kernel as one of the cells that you could variable share with. I would love to be able to run bash commands like I can in this: Jupyter kernel for bash |
Beta Was this translation helpful? Give feedback.
-
Powershell support is great, but millions of people know bash and other unix shells and will expect support for it to be "in the box". Currently you can simulate it via this:
I'd like this to just be
If you can point me in the right direction I can attempt to add an extension that enables this, at least for Linux. We could also add support for bash on WSL, perhaps separately.
Beta Was this translation helpful? Give feedback.
All reactions