diff --git a/src/CSnakes.Runtime/PackageManagement/PipInstaller.cs b/src/CSnakes.Runtime/PackageManagement/PipInstaller.cs index ea1cd993..9b37f676 100644 --- a/src/CSnakes.Runtime/PackageManagement/PipInstaller.cs +++ b/src/CSnakes.Runtime/PackageManagement/PipInstaller.cs @@ -6,11 +6,12 @@ namespace CSnakes.Runtime.PackageManagement; internal class PipInstaller(ILogger logger) : IPythonPackageInstaller { static readonly string pipBinaryName = $"pip{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : "")}"; + static readonly string requirementsFileName = "requirements.txt"; public Task InstallPackages(string home, string? virtualEnvironmentLocation) { // TODO:Allow overriding of the requirements file name. - string requirementsPath = Path.Combine(home, "requirements.txt"); + string requirementsPath = Path.Combine(home, requirementsFileName); if (File.Exists(requirementsPath)) { logger.LogInformation("File {Requirements} was found.", requirementsPath); @@ -30,7 +31,7 @@ private void InstallPackagesWithPip(string home, string? virtualEnvironmentLocat { WorkingDirectory = home, FileName = pipBinaryName, - Arguments = "install -r requirements.txt" + Arguments = $"install -r {requirementsFileName} --disable-pip-version-check" }; if (virtualEnvironmentLocation is not null) @@ -58,7 +59,7 @@ private void InstallPackagesWithPip(string home, string? virtualEnvironmentLocat { if (!string.IsNullOrEmpty(e.Data)) { - logger.LogError("{Data}", e.Data); + logger.LogWarning("{Data}", e.Data); } }; diff --git a/src/CSnakes.Runtime/PythonEnvironment.cs b/src/CSnakes.Runtime/PythonEnvironment.cs index 5dd93595..8a2bb528 100644 --- a/src/CSnakes.Runtime/PythonEnvironment.cs +++ b/src/CSnakes.Runtime/PythonEnvironment.cs @@ -90,7 +90,7 @@ private PythonEnvironment( if (extraPaths is { Length: > 0 }) { - logger.LogInformation("Adding extra paths to PYTHONPATH: {ExtraPaths}", extraPaths); + logger.LogDebug("Adding extra paths to PYTHONPATH: {ExtraPaths}", extraPaths); api.PythonPath = api.PythonPath + sep + string.Join(sep, extraPaths); } api.Initialize(); @@ -112,7 +112,7 @@ private void EnsureVirtualEnvironment(PythonLocationMetadata pythonLocation, str } else { - Logger.LogInformation("Virtual environment already exists at {VirtualEnvPath}", venvPath); + Logger.LogDebug("Virtual environment already exists at {VirtualEnvPath}", venvPath); } Process ExecutePythonCommand(PythonLocationMetadata pythonLocation, string? venvPath, string arguments) @@ -155,8 +155,8 @@ private CPythonAPI SetupStandardLibrary(PythonLocationMetadata pythonLocationMet string pythonDll = pythonLocationMetadata.LibPythonPath; string pythonPath = pythonLocationMetadata.PythonPath; - Logger.LogInformation("Python DLL: {PythonDLL}", pythonDll); - Logger.LogInformation("Python path: {PythonPath}", pythonPath); + Logger.LogDebug("Python DLL: {PythonDLL}", pythonDll); + Logger.LogDebug("Python path: {PythonPath}", pythonPath); var api = new CPythonAPI(pythonDll, pythonLocationMetadata.Version) { diff --git a/src/CSnakes/Reflection/MethodReflection.cs b/src/CSnakes/Reflection/MethodReflection.cs index a2fbb3b1..39b45766 100644 --- a/src/CSnakes/Reflection/MethodReflection.cs +++ b/src/CSnakes/Reflection/MethodReflection.cs @@ -167,7 +167,7 @@ public static MethodDefinition FromMethod(PythonFunctionDefinition function, str MemberAccessExpression( SyntaxKind.SimpleMemberAccessExpression, IdentifierName("logger"), - IdentifierName("LogInformation"))) + IdentifierName("LogDebug"))) .WithArgumentList( ArgumentList( SeparatedList(