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

Add Kernel Extension for plotly formatter #54

Merged
merged 2 commits into from Dec 9, 2020

Conversation

WalternativE
Copy link
Contributor

  • Add dependencies for extension in own group
    because they are not stable yet
  • Add fix for GenericChart JS which breaks the embedded
    charts in VSCode
  • Add notebook for visually testing extension

I'd be happy to chat about how it should be incorporated best into the standing project. This is a best effort PR right now so I'd imagine, that you want to have some things changed. I'd be happy to work with you on making this right for the project 😊

- Add dependencies for extension in own group
  because they are not stable yet
- Add fix for GenericChart JS which breaks the embedded
  charts in VSCode
- Add notebook for visually testing extension
@WalternativE WalternativE marked this pull request as ready for review December 8, 2020 22:14
@kMutagene
Copy link
Member

kMutagene commented Dec 8, 2020

Thank you for your work @WalternativE , i will check out the notebook tomorrow and play around a little before we chat about this. On first sight the only thing that i would maybe change is the namespace, 4 levels seems kinda deep

@WalternativE
Copy link
Contributor Author

Thank you for your work @WalternativE , i will check out the notebook tomorrow and play around a little before we chat about this. On first sight the only thing that i would maybe change is the namespace, 4 levels seems kinda deep

Cool, looking forward to receiving your feedback 😊 Yeah, the namespace could be shorter. I just want to make sure, that it doesn't pollute other possible Plotly.NET namespaces. Do you have something in mind?

Copy link
Member

@kMutagene kMutagene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! The notebook just works! I find it very interesting that you are actually building the library inside the notebook. I have only highlighted a few namespace changes that would simplify things (Plotly.NET.Interactive). Also, please take credit in the package metadata 😉 .

src/Plotly.NET.Interactive.Extension/paket.template Outdated Show resolved Hide resolved
Plotly.NET.sln Outdated Show resolved Hide resolved
src/Plotly.NET.Interactive.Extension/Extension.fs Outdated Show resolved Hide resolved
@@ -60,7 +60,7 @@ module HTML =
newScript.AppendLine("<script type=\"text/javascript\">") |> ignore
newScript.AppendLine(@"
var renderPlotly = function() {
var fsharpPlotlyRequire = requirejs.config({context:'fsharp-plotly',paths:{plotly:'https://cdn.plot.ly/plotly-latest.min'}});
var fsharpPlotlyRequire = requirejs.config({context:'fsharp-plotly',paths:{plotly:'https://cdn.plot.ly/plotly-latest.min'}}) || require;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also saw this one in your blog post, could you give me some info why we need to do this? My js is 'basic' 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My guess would be, that hoisting works a bit different in Electron from how it works in most browsers. When calling the immediately executed anonymous function to set up the plotly chart it tries to use the fsharpPlotlyRequire function and dies because it is undefined at the time. In other browser environments this doesn't happen. Why does this difference exist: beats me. You can try out how it behaves in VSCode (with the .NET interactive plugin) when you don't have this expression. It should work in your normal Jupyter environment, though. I can't talk about Nteract because I didn't test it there. Should also just happen for the recent versions of VSCode Insiders because they changed something there (my guess would be, that they switched to a newer Electron version, but I'm not sure).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well that's strange. I guess as long as this change does not affect the other environments we can take it.

src/Plotly.NET.Interactive.Extension/Extension.fs Outdated Show resolved Hide resolved
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is a library, can we target netstandard?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are totally right! For some reason I thought, that the .NET Interactive nuget dependency was still using netcoreapp buth either they switched to netstandard2.1 or I just mixed it up (very likely 🙈). I'll change it to netstandard2.1.

src/Plotly.NET.Interactive.Extension/paket.template Outdated Show resolved Hide resolved
- Shorten project name and related namespaces
- Reflect changes in visual inspection notebook
- Switch project to netstandard2.1
@WalternativE
Copy link
Contributor Author

Awesome! The notebook just works! I find it very interesting that you are actually building the library inside the notebook. I have only highlighted a few namespace changes that would simplify things (Plotly.NET.Interactive). Also, please take credit in the package metadata 😉 .

Yeah, it's super neat to have a way to directly test everything from the notebook. That's how they do it in the official repo. I hope, that one day it will get easier to use relative paths in .NET Interactive.

I added all the changes you requested and retested the project. Hope I didn't forget anything. If there is something else missing, just let me know.

@kMutagene kMutagene merged commit fa99037 into plotly:dev Dec 9, 2020
@kMutagene kMutagene mentioned this pull request Dec 10, 2020
13 tasks
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

Successfully merging this pull request may close these issues.

None yet

2 participants