Skip to content
This repository was archived by the owner on Apr 27, 2026. It is now read-only.

updates for Microsoft.DotNet.Interactive.Documents API stabilization#3169

Merged
jonsequitur merged 1 commit into
dotnet:mainfrom
jonsequitur:API-review-for-Documents
Sep 11, 2023
Merged

updates for Microsoft.DotNet.Interactive.Documents API stabilization#3169
jonsequitur merged 1 commit into
dotnet:mainfrom
jonsequitur:API-review-for-Documents

Conversation

@jonsequitur

Copy link
Copy Markdown
Contributor

No description provided.

internal static bool TryGetKernelInfosFromMetadata(
IDictionary<string, object>? metadata,
[NotNullWhen(true)] out KernelInfoCollection? kernelInfo)
[NotNullWhen(true)] out KernelInfoCollection? kernelInfos)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can this be inlined into the above non-static overload (with all callers switched to calling the non-static overload)? Or can this be made private?

Please ignore the above if we have more callers for the static overload outside the current class.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The static method has internal callers.

EnsureImportFieldParserIsInitialized();

if (!TryGetKernelInfoFromMetadata(Metadata, out var kernelInfos))
if (!TryGetKernelInfosFromMetadata(out var kernelInfos))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minor nit: This call uses the public instance overload while others below use the static overload. Could we standardize to the same call?

if (TryGetKernelInfosFromMetadata(Metadata, out var kernelInfo))
{
return kernelInfo.DefaultKernelName;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is the public API missing the remaining heuristics (like checking for kernelspec metadata)

}

internal static bool TryGetKernelInfoFromMetadata(
public bool TryGetKernelInfosFromMetadata(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This seems like a new public API. I don't remember adding this during the sync - was this exposed intentionally?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We discussed this during the sync, that there's currently no way to get the kernel info using the public API, and that it's very useful to have.

@jonsequitur
jonsequitur merged commit 34cc09c into dotnet:main Sep 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants