Skip to content
This repository was archived by the owner on Apr 27, 2026. It is now read-only.
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
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ Microsoft.DotNet.Interactive.Jupyter
public System.Threading.Tasks.Task StartAsync(System.Threading.CancellationToken cancellationToken)
public System.Threading.Tasks.Task StopAsync(System.Threading.CancellationToken cancellationToken)
public abstract class IJupyterEnvironment
public System.Threading.Tasks.Task<Microsoft.DotNet.Interactive.Utility.CommandLineResult> Execute(System.String command, System.String args, System.IO.DirectoryInfo workingDir = null, System.Nullable<System.TimeSpan> timeout = null)
public System.Threading.Tasks.Task<Microsoft.DotNet.Interactive.Utility.CommandLineResult> ExecuteAsync(System.String command, System.String args, System.IO.DirectoryInfo workingDir = null, System.Nullable<System.TimeSpan> timeout = null)
public System.Diagnostics.Process StartProcess(System.String command, System.String args, System.IO.DirectoryInfo workingDir, System.Action<System.String> output = null, System.Action<System.String> error = null)
public abstract class IJupyterKernelSpecModule
public System.IO.DirectoryInfo GetDefaultKernelSpecDirectory()
public IJupyterEnvironment GetEnvironment()
public System.Threading.Tasks.Task<Microsoft.DotNet.Interactive.Utility.CommandLineResult> InstallKernel(System.IO.DirectoryInfo sourceDirectory)
public System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyDictionary<System.String,KernelSpec>> ListKernels()
public System.Threading.Tasks.Task<Microsoft.DotNet.Interactive.Utility.CommandLineResult> InstallKernelAsync(System.IO.DirectoryInfo sourceDirectory)

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.

Curious what triggered these changes. From what I can read, it does not seem like there is additional validation/compat tied to these API changes but just wanted to confirm.

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 renames? A number of Task-returning methods were not named with the Async suffix. I've also renamed a couple of things for clarity.

public System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyDictionary<System.String,KernelSpec>> ListKernelsAsync()
public abstract class IJupyterMessageResponseSender
public System.Void Send(Microsoft.DotNet.Interactive.Jupyter.Protocol.PubSubMessage message)
public System.Void Send(Microsoft.DotNet.Interactive.Jupyter.Protocol.ReplyMessage message)
Expand All @@ -71,8 +71,8 @@ Microsoft.DotNet.Interactive.Jupyter
.ctor(IJupyterEnvironment environment = null)
public System.IO.DirectoryInfo GetDefaultKernelSpecDirectory()
public IJupyterEnvironment GetEnvironment()
public System.Threading.Tasks.Task<Microsoft.DotNet.Interactive.Utility.CommandLineResult> InstallKernel(System.IO.DirectoryInfo sourceDirectory)
public System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyDictionary<System.String,KernelSpec>> ListKernels()
public System.Threading.Tasks.Task<Microsoft.DotNet.Interactive.Utility.CommandLineResult> InstallKernelAsync(System.IO.DirectoryInfo sourceDirectory)
public System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyDictionary<System.String,KernelSpec>> ListKernelsAsync()
public class JupyterLocalKernelConnectionOptions, Microsoft.DotNet.Interactive.Jupyter.Connection.IJupyterKernelConnectionOptions
.ctor()
public Microsoft.DotNet.Interactive.Directives.KernelDirectiveParameter CondaEnv { get;}
Expand Down
14 changes: 14 additions & 0 deletions src/Microsoft.DotNet.Interactive.Jupyter.Tests/IMessageTracker.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using Microsoft.DotNet.Interactive.Jupyter.Messaging;

namespace Microsoft.DotNet.Interactive.Jupyter.Tests;

public interface IMessageTracker : IMessageSender, IMessageReceiver, IDisposable
{
public void Attach(IMessageSender sender, IMessageReceiver receiver);
public IObservable<Message> SentMessages { get; }
public IObservable<Message> ReceivedMessages { get; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;

namespace Microsoft.DotNet.Interactive.Jupyter.Tests;

internal sealed class JupyterHttpTestDataAttribute : JupyterTestDataAttribute
{
public const string TEST_DOTNET_JUPYTER_HTTP_CONN = nameof(TEST_DOTNET_JUPYTER_HTTP_CONN);
public const string JUPYTER_HTTP = nameof(JUPYTER_HTTP);
private static readonly string _skipReason;

static JupyterHttpTestDataAttribute()
{
_skipReason = TestConnectionAndReturnSkipReason();
}

public JupyterHttpTestDataAttribute(params object[] data) : base(data)
{
if (_skipReason is not null)
{
Skip = _skipReason;
}
}

internal static string TestConnectionAndReturnSkipReason()
{
string connectionString = GetConnectionString();
if (string.IsNullOrWhiteSpace(connectionString))
{
return $"Environment variable {TEST_DOTNET_JUPYTER_HTTP_CONN} is not set. To run tests that require "
+ "Jupyter server running, this environment variable must be set to a valid connection string value with --url and --token.";
}

return null;
}

public static string GetConnectionString()
{
// e.g. --url <server> --token <token>
return Environment.GetEnvironmentVariable(TEST_DOTNET_JUPYTER_HTTP_CONN);
}

protected override JupyterConnectionTestData GetConnectionTestData()
{
return new JupyterConnectionTestData(JUPYTER_HTTP,
new SimulatedJupyterConnectionOptions(new JupyterHttpKernelConnectionOptions(), KernelSpecName, AllowPlayback),
GetConnectionString()
);
}

/// <summary>
/// Allows playing back the record of the connection by enabling save to a file
/// and reading back from it at the point of save.
/// </summary>
public bool AllowPlayback { get; set; }
}

Large diffs are not rendered by default.

Loading