Default language not applied after open an python ipynb file
Describe the bug
With polyglot notebook installed in VS Code. Open an ipynb file with python code cells in it. Select kernel ".NET Interactive"
Even the default language configuration is F#, all the cells are initialized with C# language.
Please complete the following:
Which version of .NET Interactive are you using? (In a notebook, run the #!about magic command. ):
.NET Interactive
© 2020 Microsoft Corporation
Version: 1.0.512901+07977b2f577c0c9a2bc47fc2ca1df2f59a14c825
Library version: 1.0.0-beta.24129.1+07977b2f577c0c9a2bc47fc2ca1df2f59a14c825
Build date: 2024-03-10T05:03:32.3855964Z
-
OS
- [ ] Windows Server 2019
-
Frontend
- [ ] Visual Studio Code
Even the default language configuration is F#
Could you provide more details? Are you describing a default for the specific notebook file? How was the notebook created?
Hi, ^^
https://github.com/d2l-ai/d2l-zh-pytorch-colab/blob/main/chapter_preliminaries/probability.ipynb
I don't know how it was created...
I am experiencing an issue like this also. If I add a new file in vscode and name it (the code block) file.dib it will default to C#. I then have to change the block to f-sharp.
The vscode Polyglot-notebook: Default Notebook Language setting is set to fsharp.
Looking at the file.dib in a text editor, I see this
#!meta
{"kernelInfo":{"defaultKernelName":"csharp","items":[{"aliases":[],"name":"csharp"}]}}
#!fsharp
//test
so the extension seems to not be picking up the default setting.
I tried on linux and windows and both do this. linux -> LMDE6 (Linux Mint Debian Edition 6) windows -> 10
Version: 1.87.1
Commit: 1e790d77f81672c49be070e04474901747115651
Date: 2024-03-06T00:21:07.287Z
Electron: 27.3.2
ElectronBuildId: 26836302
Chromium: 118.0.5993.159
Node.js: 18.17.1
V8: 11.8.172.18-electron.0
OS: Linux x64 6.1.0-18-amd64
.NET Interactive
© 2020 Microsoft Corporation
Version: 1.0.516401+c4e9b8ca9ec9d23dc04cf02cc5bfce25a157384b
Library version: 1.0.0-beta.24164.1+c4e9b8ca9ec9d23dc04cf02cc5bfce25a157384b
Build date: 2024-03-14T21:26:06.0000000Z
But this works fine.
https://github.com/dotnet/TorchSharpExamples/blob/main/tutorials/FSharp/synthetic_data.ipynb
Once we open the ipynb file and all cells are in F#.
The default language setting only affects new notebooks. Existing notebooks will have a default language set in their metadata, which takes precedence over this setting.
I don't know how it was created...
Based on the metadata from the notebook you linked, I would assume Jupyter. It doesn't contain .NET Interactive metadata but it seems like the correct behavior would be to identify the cells as being Python.
But when I change the kernel from CPython to .net interactive, it changes all cells into c#, even not Python....
Yes, that's a bug.