< Summary

Information
Class: Elsa.Expressions.Python.ShellFeatures.PythonFeature
Assembly: Elsa.Expressions.Python
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Expressions.Python/ShellFeatures/PythonFeature.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 9
Coverable lines: 9
Total lines: 50
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_PythonOptions()100%210%
ConfigureServices(...)100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Expressions.Python/ShellFeatures/PythonFeature.cs

#LineLine coverage
 1using CShells.Features;
 2using Elsa.Expressions.Python.Activities;
 3using Elsa.Expressions.Python.Contracts;
 4using Elsa.Expressions.Python.HostedServices;
 5using Elsa.Expressions.Python.Options;
 6using Elsa.Expressions.Python.Providers;
 7using Elsa.Expressions.Python.Services;
 8using Elsa.Extensions;
 9using Elsa.Workflows;
 10using JetBrains.Annotations;
 11using Microsoft.Extensions.DependencyInjection;
 12
 13namespace Elsa.Expressions.Python.ShellFeatures;
 14
 15/// <summary>
 16/// Installs Python integration.
 17/// </summary>
 18[ShellFeature(
 19    DisplayName = "Python Expressions",
 20    Description = "Provides Python expression evaluation capabilities for workflows",
 21    DependsOn = ["Mediator", "Expressions"])]
 22[UsedImplicitly]
 23public class PythonFeature : IShellFeature
 24{
 25    /// <summary>
 26    /// Configures the <see cref="Options.PythonOptions"/>.
 27    /// </summary>
 028    public Action<PythonOptions> PythonOptions { get; set; } = _ => { };
 29
 30    public void ConfigureServices(IServiceCollection services)
 31    {
 032        services.Configure(PythonOptions);
 33
 34        // Python services.
 035        services
 036            .AddScoped<IPythonEvaluator, PythonNetPythonEvaluator>()
 037            .AddExpressionDescriptorProvider<PythonExpressionDescriptorProvider>();
 38
 39        // Handlers.
 040        services.AddNotificationHandlersFrom<PythonFeature>();
 41
 42        // UI property handlers.
 043        services.AddScoped<IPropertyUIHandler, RunPythonOptionsProvider>();
 44
 45        // Hosted services.
 046        services.AddHostedService<PythonGlobalInterpreterManager>();
 047    }
 48}
 49
 50