vors / jupyter-powershell

PowerShell language kernel for Jupyter
MIT License
132 stars 26 forks source link

Cell to cell caching results #15

Closed TRM13 closed 4 years ago

TRM13 commented 5 years ago

I’ve loaded up the latest anaconda 3.7 distro and I’m running notebook 6.0.0 I’m working with the Powershell kernel & Firefox 68 for a browser.

When I run one cell then go run the next it shows the output from the previous cell. When I run it a second time it then shows the correct output.

I’ve tried 3 different browsers, turned off caching, and even ran the no-f*cking-cache-browser but it still happens.

TRM13 commented 5 years ago

I just tried the NB-console (not terminal, that works) and it seems to be doing the same thing. Is it something like missing CR/LF? My Linux stuff doesn't have this issue and it uses just "LF" so maybe due to this being powershell on windows it is waiting for a "CR+LF" as windows uses both (Mac uses just CR, Unix just LF).

TRM13 commented 5 years ago

I may have found a work around. When I had these 3 lines in one code cell the third command would cause the problem. Once I put them all in their own cells it now works:

New-Item -ItemType Directory -Path "C:\Users\Administrator\Documents\WindowsPowershell" Set-Location C:\Users\Administrator\Documents\WindowsPowershell New-Item -ItemType file -force $profile

If I run them all on one line separated by semi-colons it also works. It also runs fine if I put it in a PS1 script. Only when the 3 lines are in one cell does the "caching" happen and you have to run following cells twice to get the correct result.

I'll close this one but leave this here in case someone else stumbles across this behaviour.

vors commented 5 years ago

Oh, I think it's a bug in the kernel. It uses a crappy heuristic to identify the end of the output for a particular cell. Let me keep it open for investigation.

TRM13 commented 5 years ago

Okay thanks. In the mean time the work around is holding up. For very long hash tables where I want more than one line I go with a script.

Thanks for all the work on this. I wish Microsoft would do a Powershell kernel for Notebook.

SQLvariant commented 5 years ago

Oh, I think it's a bug in the kernel. It uses a crappy heuristic to identify the end of the output for a particular cell. Let me keep it open for investigation.

I can definitely reproduce this issue. I'd love to get it solved.

robertoabraham commented 5 years ago

I can reproduce it too. The issue sometimes occurs even when using simple commands. For example, generally speaking if I start from a fresh kernel, if I execute Set-Location in one code cell, then execute Get-Location in the next, I get the expected behavior (i.e. no output from the Set-Location invocation, but the current directory gets output by Get-Location). However, sometimes executing the Get-Location cell show nothing, but then executing the Set-Location command again shows the result from the invocation of the previous Get-Location.

I'm running Python 3.7.3 (installed via Anaconda).

vors commented 5 years ago

Wow, didn't know so many people are finding this kernel useful! Honestly this was a just POC when I created it. Would anybody be interested in becoming a maintainer?

There is also another powershell kernel that may be more stable https://github.com/Jaykul/Jupyter-PowerShell but I'm not 100% sure about the status there and does it get any updates or not.

TRM13 commented 5 years ago

The Jaykul kernel is based on PWSH-Core which only has 300+ commands. It may be viable for PWSH version 7 as that is where Microsoft stops doing 2 streams (Core & Windows) and just goes with Core.

What would be involved with being a maintainer? What coding skills would I need? How much time would it take? etc?

Thanks

SQLvariant commented 5 years ago

Wow, didn't know so many people are finding this kernel useful! Honestly this was a just POC when I created it. Would anybody be interested in becoming a maintainer?

There is also another powershell kernel that may be more stable https://github.com/Jaykul/Jupyter-PowerShell but I'm not 100% sure about the status there and does it get any updates or not.

I may know some folks interested in maintaining this code base. I will check with them and get back to you as soon as I can @vors.

vors commented 5 years ago

Cool, before onboarding somebody as a maintainer, I'd like to see them becoming a contributor. This one is a good issue to fix. Also #10 is my personal pet peeve.

vors commented 5 years ago

Ok, I split the conversation into it's own issue and addressed some of your question there @TRM13 . Really appreciate all the interest that people are expressing, let's figure out the future of this project together!

vors commented 4 years ago

Fixed in #17