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

Jupyter/merge from main #2774

Merged
merged 30 commits into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
4e85881
change log level (#2719)
colombod Feb 11, 2023
7dd1eb9
fix handling of completions that rely on nested commands (#2727)
jonsequitur Feb 14, 2023
fbcafb8
fix package import (#2734)
colombod Feb 14, 2023
c8a0c6d
Rename the netstandard2.0 package (#2739)
shyamnamboodiripad Feb 15, 2023
bfc84b4
value kernel should not produce reference values (#2740)
colombod Feb 16, 2023
07807c1
readme link 404 fix
jbilinski Feb 16, 2023
63be6f4
share cancellation source (#2743)
colombod Feb 16, 2023
a23884e
fix size in style
colombod Feb 16, 2023
2139e49
use set command
colombod Feb 16, 2023
05d6872
Update publish-npm.yml
brettfo Feb 16, 2023
a8b18e9
report all errors when generating dynamic semantic tokens (#2747)
brettfo Feb 16, 2023
7ceff87
fix again ... (#2749)
colombod Feb 17, 2023
6e742e5
improve kql and sql connection experience (#2745)
colombod Feb 17, 2023
4f9f902
Update README.md
jonsequitur Feb 19, 2023
3731a79
Updating the test script with the latest saved content for .dib and .…
AbhitejJohn Feb 17, 2023
f41a3c6
allow persisting default values for new notebooks (#2712)
brettfo Feb 21, 2023
ad0cba2
cancelling doesn't leak infos
colombod Feb 21, 2023
63efda3
cleanup
jonsequitur Feb 21, 2023
2952c6c
throw on null FormattedValue
jonsequitur Feb 21, 2023
24cb18f
move #!set handling to custom parser, add support for --byref
jonsequitur Feb 22, 2023
be17230
cleanup
jonsequitur Feb 22, 2023
48e1a89
move #!set --value @sharing to custom parser, add --byref
jonsequitur Feb 24, 2023
20867aa
fix sql test assertion
colombod Feb 27, 2023
de531f0
honour content type
colombod Feb 27, 2023
7d2ebbb
Update dependencies from https://github.com/dotnet/arcade build 20230…
dotnet-maestro[bot] Feb 27, 2023
bf28192
merge from main
shibbas Feb 28, 2023
dcfe7bf
Remove not needed code
kant2002 Feb 28, 2023
42cbc9d
upgraded js
colombod Feb 28, 2023
11e6e76
Merge branch 'release/jupyter' into jupyter/merge-from-main
shibbas Mar 1, 2023
d6e8a1e
Merge branch 'main' into jupyter/merge-from-main
shibbas Mar 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<ProductDependencies>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="7.0.0-beta.23108.1">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="7.0.0-beta.23122.4">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>5eac3ace1b09862bd7421ba55795cc2a9c6a57d5</Sha>
<Sha>2e0fab0209c66d181d93b0d03bc267db5bde75be</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
6 changes: 3 additions & 3 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"sdk": {
"version": "7.0.100",
"version": "7.0.103",
"allowPrerelease": true,
"rollForward": "latestMinor"
},
"tools": {
"dotnet": "7.0.100",
"dotnet": "7.0.103",
"rollForward": "latestMinor"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.22554.2"
"Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.23122.4"
}
}
78 changes: 68 additions & 10 deletions samples/notebooks/polyglot/polyglot telemetry.dib
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!meta

{"kernelInfo":{"defaultKernelName":null,"items":[{"name":"csharp","languageName":"C#","aliases":["c#","cs"]},{"name":"fsharp","languageName":"F#","aliases":["f#","fs"]},{"name":"pwsh","languageName":"PowerShell","aliases":["powershell"]},{"name":"javascript","languageName":"JavaScript","aliases":["js"]},{"name":"html","languageName":"HTML"},{"name":"sql","languageName":"SQL"},{"name":"kql","languageName":"KQL"},{"name":"mermaid","languageName":"Mermaid"},{"name":"http","languageName":"HTTP"},{"name":"value"}]}}
{"kernelInfo":{"defaultKernelName":"csharp","items":[{"name":"csharp","aliases":[]}]}}

#!csharp

Expand Down Expand Up @@ -254,6 +254,11 @@ delay = (delayAmount) => new Promise(resolve => setTimeout(resolve, delayAmount)
await delay(500);

loadd3(["d3"], (d3) => {

const width = 2048;
const height = 2048;
const maxR = 50;

const maxStrength = d3.max(graph.edges, (e) => e.temperature);
const minStrength = d3.min(graph.edges, (e) => e.temperature);
const maxPopularity = d3.max(graph.nodes, (n) => n.popularity);
Expand All @@ -265,12 +270,22 @@ loadd3(["d3"], (d3) => {
const tempScale = d3.scaleLog()
.domain([minStrength, maxStrength])
.range([0, 1]);

const nodes = d3.map(graph.nodes, (n, i) => ({id: i, language: n.language, popularity: n.popularity/maxPopularity}));
const links = d3.map(graph.edges, (e, i) => ({source: e.source, target: e.destination, strength: e.temperature/maxStrength}));
const links = d3.map(graph.edges, (e, i) => ({source: e.source, target: e.destination, strength: e.temperature/maxStrength, weight: e.weight, id: i}));
const color = d3.scaleOrdinal(d3.map(graph.nodes, (n, i) => n.language), d3.schemeTableau10);
const width = 2048;
const height = 2048;
const maxR = 50;

nodes.forEach((n,i)=>{
if(n.language.includes(`single`)){
n.x = 0;

}else{
n.x = width;
}

n.y = i + (height / nodes.lenght);
});

const collisionScale = 2.5;
const svg = d3.select("#forceLayout")
.attr("width", width)
Expand Down Expand Up @@ -340,9 +355,10 @@ loadd3(["d3"], (d3) => {
.selectAll(".link")
.data(links)
.join("path")
.attr("id", d => d.id)
.attr("fill", "none")
.attr("stroke", d => color(nodes[d.source].language))
.attr("stroke-width", (d) => 3 + tempScale(d.strength) * 10)
.attr("stroke-width", (d) => 3 + tempScale(d.strength) * 5)
.classed("link", true);

node = svg
Expand All @@ -351,10 +367,27 @@ loadd3(["d3"], (d3) => {
.join("g")
.classed("node_group", true);

linkLabels = svg
.selectAll(".linkLabel")
.data(links)
.join("text")
.append("textPath")
.attr("font-family", "Arial, Helvetica, sans-serif")
.attr("dominant-baseline","Hanging")
.style("font", "normal 16px Arial")
.text(d => "")
.classed("linkLabel",true);



function tick() {
link.attr("d", linkArc);
node.attr("transform", d => `translate(${d.x},${d.y})`);
linkLabels.attr("xlink:href", d => `#${d.id}`) //place the ID of the path here
.style("text-anchor","middle") //place the text halfway on the arc
.attr("startOffset", "50%")
.attr("fill", "white");

quadtree.addAll(nodes);
}

Expand All @@ -374,6 +407,7 @@ loadd3(["d3"], (d3) => {
//node.y = Math.max(-x, Math.min(x, node.y));
}
}

function truncateText(text, length) {
var l = text.split(" ");
if(notToTruncate.has(l[0])) {
Expand All @@ -385,13 +419,14 @@ loadd3(["d3"], (d3) => {
return text;
}
}

simulation = d3
.forceSimulation()
.nodes(nodes)
.force('collision', d3.forceCollide().radius(d => scale( d.popularity ) * maxR * collisionScale))
.force("charge", d3.forceManyBody().strength(d => scale( d.popularity ) * -200))
.force("center", d3.forceCenter(width / 2, height / 2))
.force("link", d3.forceLink(links).strength ( (d) => tempScale(d.strength) * 1.2))
.force("link", d3.forceLink(links).strength ( (d) => tempScale(d.strength) * 0.01))
.force("bounds", boxingForce)
.on("tick", tick);

Expand All @@ -406,7 +441,7 @@ loadd3(["d3"], (d3) => {
node.append("text")
.attr("x", d=> 8 +scale( d.popularity ) * maxR)
.attr("y", "0.31em")
.text(d => truncateText( d.language,10 ))
.text(d => truncateText( d.language, 10 ))
.attr("fill", d => color(d.language))
.classed("nodeText", true)
.raise ()
Expand All @@ -417,9 +452,8 @@ loadd3(["d3"], (d3) => {
.clone(true).lower()
.attr("fill", "none")
.attr("stroke", "rgba(255, 255, 255, 0.2)")
.attr("stroke-width", 4);
.attr("stroke-width", 4);



svg.on('mousemove', (e) => handleMousemove(e, quadtree));

Expand Down Expand Up @@ -481,6 +515,8 @@ loadd3(["d3"], (d3) => {
return c;
});



svg
.selectAll(".link")
.each(function (d) {
Expand Down Expand Up @@ -516,6 +552,8 @@ loadd3(["d3"], (d3) => {
.each(function (d) {
if(network.has(d.id)) {
d3.select(this).raise();
}else{
d3.select(this).lower();
}
});

Expand All @@ -524,7 +562,27 @@ loadd3(["d3"], (d3) => {
.each(function (d) {
if(network.has(d.id)) {
d3.select(this).raise();
}else{
d3.select(this);
}
});

svg
.selectAll(".linkLabel")
.data(links)
.each(function (d) {
let node = d.source;
let c = color(node.language);
if(selectedNode){
const found = d.source.id === selectedNode.id || d.target.id === selectedNode.id;
if(found){
d3.select(this).text(d => d.weight);
}else{
d3.select(this).text("");
}
}else{
d3.select(this).text("");
}
});
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ Microsoft.DotNet.Interactive.Parsing
public System.String DirectiveName { get;}
public class KernelNameDirectiveNode : DirectiveNode
public class LanguageNode : SyntaxNode
public System.String KernelName { get;}
public System.String Name { get;}
public System.Collections.Generic.IEnumerable<Diagnostic> GetDiagnostics()
public class LanguageSpecificParseResult
public static LanguageSpecificParseResult None { get;}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
<NoWarn>;NU5104;2003</NoWarn>
</PropertyGroup>

<PropertyGroup Condition="$(TargetFramework.StartsWith('netstandard')) AND '$(OS)' == 'Windows_NT'">
<!-- the 2.1.503 F# compiler can produce PDBs that can't properly be converted, see https://github.com/Microsoft/visualfsharp/issues/5976 -->
<PublishWindowsPdb>false</PublishWindowsPdb>
</PropertyGroup>

<ItemGroup>
<Compile Include="FsAutoComplete\Utils.fs" />
<Compile Include="FsAutoComplete\TypedAstUtils.fs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static async Task<InteractiveDocument> LoadNotebookFromUrl(
var response = await client.GetAsync(uri);
var content = await response.Content.ReadAsStringAsync();

// FIX: (LoadNotebookFromUrl) differentiate file formats
// TODO: (LoadNotebookFromUrl) differentiate file formats

return CodeSubmission.Parse(content, GetKernelInfoFromKernel(kernel));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,12 @@ public async Task GetCorrectProfilePaths()
await kernel.SubmitCodeAsync("$currentUserCurrentHost = $PROFILE.CurrentUserCurrentHost");
await kernel.SubmitCodeAsync("$allUsersCurrentHost = $PROFILE.AllUsersCurrentHost");

var (success, valueProduced) = await kernel.TryRequestValueAsync("currentUserCurrentHost");
success.Should().BeTrue();
var valueProduced = await kernel.RequestValueAsync("currentUserCurrentHost");
valueProduced.Value.Should().BeOfType<string>();
string currentUserCurrentHost = valueProduced.Value.As<string>();

// Get $PROFILE default.
(success, valueProduced) = await kernel.TryRequestValueAsync("PROFILE");
success.Should().BeTrue();
valueProduced = await kernel.RequestValueAsync("PROFILE");
valueProduced.Value.Should().BeOfType<string>();
string profileDefault = valueProduced.Value.As<string>();

Expand All @@ -187,8 +185,7 @@ public async Task GetCorrectProfilePaths()
profileDefault.Should().NotBeNullOrEmpty();
profileDefault.Should().Be(currentUserCurrentHost);

(success, valueProduced) = await kernel.TryRequestValueAsync("allUsersCurrentHost");
success.Should().BeTrue();
valueProduced = await kernel.RequestValueAsync("allUsersCurrentHost");
valueProduced.Value.Should().BeOfType<string>();
string allUsersCurrentHost = valueProduced.Value.As<string>();

Expand All @@ -210,8 +207,7 @@ public async Task VerifyAllUsersProfileRuns()
// trigger first time setup.
await kernel.SubmitCodeAsync("Get-Date");

var (success, valueProduced) = await kernel.TryRequestValueAsync(randomVariableName);
success.Should().BeTrue();
var valueProduced = await kernel.RequestValueAsync(randomVariableName);

valueProduced.Value.Should().BeOfType<bool>();
valueProduced.Value.As<bool>().Should().BeTrue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public async Task It_gives_error_if_kernel_name_is_already_used()
.Which
.Message
.Should()
.Contain("\"A kernel with name adventureworks is already present. Use a different value for the --kernel-name option.\"");
.Contain("A kernel with name adventureworks is already present. Use a different value for the --kernel-name option.");
}

[MsSqlFact]
Expand Down
41 changes: 26 additions & 15 deletions src/Microsoft.DotNet.Interactive.Tests/KeyValueStoreKernelTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ await kernel.SubmitCodeAsync(

var keyValueStoreKernel = kernel.FindKernelByName("value");

var (success, valueProduced) = await keyValueStoreKernel.TryRequestValueAsync("hi");
var valueProduced = await keyValueStoreKernel.RequestValueAsync("hi");

valueProduced.FormattedValue.Value
.Should()
.Be(storedValue);
.Should()
.Be(storedValue);
}

[Fact]
Expand Down Expand Up @@ -179,7 +179,7 @@ public async Task It_can_import_file_contents_as_strings(string code)

var keyValueStoreKernel = kernel.FindKernelByName("value");

var (success, valueProduced) = await keyValueStoreKernel.TryRequestValueAsync("hi");
var valueProduced = await keyValueStoreKernel.RequestValueAsync("hi");

valueProduced.FormattedValue.Value
.Should()
Expand All @@ -191,17 +191,33 @@ public async Task It_can_import_URL_contents_as_strings()
{
using var kernel = CreateKernel();

await kernel.SubmitCodeAsync("#!value --name hi --from-url http://bing.com");
await kernel.SubmitCodeAsync("#!value --name hi --from-url https://bing.com");

var keyValueStoreKernel = kernel.FindKernelByName("value");

var (success, valueProduced) = await keyValueStoreKernel.TryRequestValueAsync("hi");
var valueProduced = await keyValueStoreKernel.RequestValueAsync("hi");

valueProduced.FormattedValue.Value
.Should()
.Contain("<html");
}

[Fact]
public async Task When_import_URL_contents_the_mimetype_is_preserved()
{
using var kernel = CreateKernel();

await kernel.SubmitCodeAsync("#!value --name hi --from-url https://bing.com");

var keyValueStoreKernel = kernel.FindKernelByName("value");

var valueProduced = await keyValueStoreKernel.RequestValueAsync("hi");

valueProduced.FormattedValue.MimeType
.Should()
.Be("text/html");
}

[Fact]
public async Task It_can_store_user_input()
{
Expand All @@ -218,7 +234,7 @@ public async Task It_can_store_user_input()

var keyValueStoreKernel = kernel.FindKernelByName("value");

var (success, valueProduced) = await keyValueStoreKernel.TryRequestValueAsync("hi");
var valueProduced = await keyValueStoreKernel.RequestValueAsync("hi");

valueProduced.FormattedValue.Value
.Should()
Expand Down Expand Up @@ -287,8 +303,7 @@ public async Task Share_into_the_value_kernel_is_not_supported_and_stores_the_di

var valueKernel = (KeyValueStoreKernel)kernel.FindKernelByName("value");

var (success, valueProduced) = await valueKernel.TryRequestValueAsync("x");
success.Should().BeTrue();
var valueProduced = await valueKernel.RequestValueAsync("x");

valueProduced.FormattedValue.Value.Should().Be("#!share --from fsharp f");
}
Expand Down Expand Up @@ -398,12 +413,8 @@ await kernel.SubmitCodeAsync($@"

var valueKernel = kernel.FindKernelByName("value");

var (success, valueProduced) = await valueKernel.TryRequestValueAsync("hi");

success
.Should()
.BeTrue();

var valueProduced = await valueKernel.RequestValueAsync("hi");

valueProduced.FormattedValue.Value
.Should()
.Be("// previous content");
Expand Down
Loading