Skip to content

Update to the latest Microsoft.DotNet.Interactive #5710

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

Merged
merged 4 commits into from
Mar 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,8 @@ dotnet_diagnostic.MSML_ExtendBaseTestClass.severity = none
# The MSML_RelaxTestNaming suppressor for VSTHRD200 is not active for CodeAnalyzer.Tests, so we disable it altogether.
# VSTHRD200: Use "Async" suffix for async methods
dotnet_diagnostic.VSTHRD200.severity = none

# Xml project files
[*.{csproj}]
indent_size = 2
charset = utf-8
1 change: 1 addition & 0 deletions NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<clear />
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" />
<add key="dotnet-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
<add key="dotnet-libraries" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-libraries/nuget/v3/index.json" />
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
<add key="vs-buildservices" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/vs-buildservices/nuget/v3/index.json" />
<add key="dotnet5-roslyn" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json" />
Expand Down
4 changes: 2 additions & 2 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
<TensorFlowMajorVersion>2</TensorFlowMajorVersion>
<TensorflowDotNETVersion>0.20.1</TensorflowDotNETVersion>
<MicrosoftCodeAnalysisCSharpInternalAnalyzerVersion>3.3.1</MicrosoftCodeAnalysisCSharpInternalAnalyzerVersion>
<MicrosoftDotNetInteractiveVersion>1.0.0-beta.20410.1</MicrosoftDotNetInteractiveVersion>
<MicrosoftDotNetInteractiveFormattingVersion>1.0.0-beta.20410.1</MicrosoftDotNetInteractiveFormattingVersion>
<MicrosoftDotNetInteractiveVersion>1.0.0-beta.21155.3</MicrosoftDotNetInteractiveVersion>
<MicrosoftDotNetInteractiveFormattingVersion>1.0.0-beta.21155.3</MicrosoftDotNetInteractiveFormattingVersion>
<ApacheArrowVersion>2.0.0</ApacheArrowVersion>
<SystemTextEncodingVersion>4.3.0</SystemTextEncodingVersion>
<MicrosoftCSharpVersion>4.5.0</MicrosoftCSharpVersion>
Expand Down
30 changes: 15 additions & 15 deletions src/Microsoft.Data.Analysis.Interactive/DataFrameKernelExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ public Task OnLoadAsync(Kernel kernel)

public static void RegisterDataFrame()
{
Formatter<DataFrame>.Register((df, writer) =>
Formatter.Register<DataFrame>((df, writer) =>
{
const int MAX = 10000;
const int SIZE = 10;
const int maxRowCount = 10000;
const int rowsPerPage = 25;

var uniqueId = DateTime.Now.Ticks;

Expand All @@ -37,15 +37,15 @@ public static void RegisterDataFrame()
};
header.AddRange(df.Columns.Select(c => (IHtmlContent)th(c.Name)));

if (df.Rows.Count > SIZE)
if (df.Rows.Count > rowsPerPage)
{
var maxMessage = df.Rows.Count > MAX ? $" (showing a max of {MAX} rows)" : string.Empty;
var maxMessage = df.Rows.Count > maxRowCount ? $" (showing a max of {maxRowCount} rows)" : string.Empty;
var title = h3[style: "text-align: center;"]($"DataFrame - {df.Rows.Count} rows {maxMessage}");

// table body
var maxRows = Math.Min(MAX, df.Rows.Count);
var rowCount = Math.Min(maxRowCount, df.Rows.Count);
var rows = new List<List<IHtmlContent>>();
for (var index = 0; index < maxRows; index++)
for (var index = 0; index < rowCount; index++)
{
var cells = new List<IHtmlContent>
{
Expand All @@ -58,29 +58,29 @@ public static void RegisterDataFrame()
rows.Add(cells);
}

//navigator
//navigator
var footer = new List<IHtmlContent>();
BuildHideRowsScript(uniqueId);

var paginateScriptFirst = BuildHideRowsScript(uniqueId) + GotoPageIndex(uniqueId, 0) + BuildPageScript(uniqueId, SIZE);
var paginateScriptFirst = BuildHideRowsScript(uniqueId) + GotoPageIndex(uniqueId, 0) + BuildPageScript(uniqueId, rowsPerPage);
footer.Add(button[style: "margin: 2px;", onclick: paginateScriptFirst]("⏮"));

var paginateScriptPrevTen = BuildHideRowsScript(uniqueId) + UpdatePageIndex(uniqueId, -10, (maxRows - 1) / SIZE) + BuildPageScript(uniqueId, SIZE);
var paginateScriptPrevTen = BuildHideRowsScript(uniqueId) + UpdatePageIndex(uniqueId, -10, (rowCount - 1) / rowsPerPage) + BuildPageScript(uniqueId, rowsPerPage);
footer.Add(button[style: "margin: 2px;", onclick: paginateScriptPrevTen]("⏪"));

var paginateScriptPrev = BuildHideRowsScript(uniqueId) + UpdatePageIndex(uniqueId, -1, (maxRows - 1) / SIZE) + BuildPageScript(uniqueId, SIZE);
var paginateScriptPrev = BuildHideRowsScript(uniqueId) + UpdatePageIndex(uniqueId, -1, (rowCount - 1) / rowsPerPage) + BuildPageScript(uniqueId, rowsPerPage);
footer.Add(button[style: "margin: 2px;", onclick: paginateScriptPrev]("◀️"));

footer.Add(b[style: "margin: 2px;"]("Page"));
footer.Add(b[id: $"page_{uniqueId}", style: "margin: 2px;"]("1"));

var paginateScriptNext = BuildHideRowsScript(uniqueId) + UpdatePageIndex(uniqueId, 1, (maxRows - 1) / SIZE) + BuildPageScript(uniqueId, SIZE);
var paginateScriptNext = BuildHideRowsScript(uniqueId) + UpdatePageIndex(uniqueId, 1, (rowCount - 1) / rowsPerPage) + BuildPageScript(uniqueId, rowsPerPage);
footer.Add(button[style: "margin: 2px;", onclick: paginateScriptNext]("▶️"));

var paginateScriptNextTen = BuildHideRowsScript(uniqueId) + UpdatePageIndex(uniqueId, 10, (maxRows - 1) / SIZE) + BuildPageScript(uniqueId, SIZE);
var paginateScriptNextTen = BuildHideRowsScript(uniqueId) + UpdatePageIndex(uniqueId, 10, (rowCount - 1) / rowsPerPage) + BuildPageScript(uniqueId, rowsPerPage);
footer.Add(button[style: "margin: 2px;", onclick: paginateScriptNextTen]("⏩"));

var paginateScriptLast = BuildHideRowsScript(uniqueId) + GotoPageIndex(uniqueId, (maxRows - 1) / SIZE) + BuildPageScript(uniqueId, SIZE);
var paginateScriptLast = BuildHideRowsScript(uniqueId) + GotoPageIndex(uniqueId, (rowCount - 1) / rowsPerPage) + BuildPageScript(uniqueId, rowsPerPage);
footer.Add(button[style: "margin: 2px;", onclick: paginateScriptLast]("⏭️"));

//table
Expand All @@ -93,7 +93,7 @@ public static void RegisterDataFrame()
writer.Write(t);

//show first page
writer.Write($"<script>{BuildPageScript(uniqueId, SIZE)}</script>");
writer.Write($"<script>{BuildPageScript(uniqueId, rowsPerPage)}</script>");
}
else
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable>
<NoWarn>$(NoWarn);MSML_ParameterLocalVarName;SA1028</NoWarn>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.DotNet.Interactive" Version="$(MicrosoftDotNetInteractiveVersion)" />
<PackageReference Include="Microsoft.DotNet.Interactive.Formatting" Version="$(MicrosoftDotNetInteractiveFormattingVersion)" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.Interactive" Version="$(MicrosoftDotNetInteractiveVersion)" />
<PackageReference Include="Microsoft.DotNet.Interactive.Formatting" Version="$(MicrosoftDotNetInteractiveFormattingVersion)" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Microsoft.Data.Analysis\Microsoft.Data.Analysis.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.Data.Analysis\Microsoft.Data.Analysis.csproj" />
</ItemGroup>

</Project>
Loading