Kephas.Scripting.Python 11.0.0-dev.5

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
This is a prerelease version of Kephas.Scripting.Python.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Kephas.Scripting.Python --version 11.0.0-dev.5
NuGet\Install-Package Kephas.Scripting.Python -Version 11.0.0-dev.5
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Kephas.Scripting.Python" Version="11.0.0-dev.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Kephas.Scripting.Python --version 11.0.0-dev.5
#r "nuget: Kephas.Scripting.Python, 11.0.0-dev.5"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Kephas.Scripting.Python as a Cake Addin
#addin nuget:?package=Kephas.Scripting.Python&version=11.0.0-dev.5&prerelease

// Install Kephas.Scripting.Python as a Cake Tool
#tool nuget:?package=Kephas.Scripting.Python&version=11.0.0-dev.5&prerelease

Python Scripting

Introduction

The Python scripting area in Kephas handles Python dynamic code execution using IronPython.

Check the following packages for more information:

Usage

  • String based script execution
// normally you would get the processor injected into the service constructor.
var processor = injector.Resolve<IScriptProcessor>();
var result = await processor.ExecuteAsync(new PythonStringScript("name[..4] + str(age)"), new Expando { ["name"] = "Johnny", ["age"] = 42 })).PreserveThreadContext();
Assert.Equals("John42", result);
  • File based script execution

The file scripts assume that the language can be inferred from the file extension. For Python, it means that the file needs to and with a *.py extension. If this is not the case, make sure you specify the language explicitly when creating a FileScript.

// normally you would get the processor injected into the service constructor.
var processor = injector.Resolve<IScriptProcessor>();

// Python scripts ending with *.py
var result = await processor.ExecuteAsync(new FileScript("myscript.py"), new { name = "Johnny", age = 42 })).PreserveThreadContext();
Assert.Equals("John42", result);

// Python scripts not ending with *.py
var result = await processor.ExecuteAsync(new FileScript("myscript.txt", PythonLanguageService.Language), new { name = "Johnny", age = 42 })).PreserveThreadContext();
Assert.Equals("John42", result);

The PythonLanguageService

This service is the ILanguageService implementation for the Python language. It uses the PythonSettings to configure the way it controls the execution. These are the options:

  • SearchPaths (string[]): enumerates the paths where the Python modules should be searched.
  • PreloadGlobalModules (boolean): Indicates whether the modules found in the search paths should be preloaded for the executing scripts. This way, the scripts would be simpler to write, but the resource consumption could be greater.

Note: The search paths are locations handled by the ILocationsManager service. When adding tenant support, each tenant will get its own copy.

Configuration file example:

{
    "searchPaths": [ "../config/.pylib" ],
    "preloadGlobalModules": true
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
11.1.0 575 4/13/2022
11.1.0-dev.4 130 4/6/2022
11.1.0-dev.3 123 3/30/2022
11.1.0-dev.2 124 3/23/2022
11.1.0-dev.1 116 3/23/2022
11.0.0 474 3/11/2022
11.0.0-dev.7 128 3/7/2022
11.0.0-dev.6 119 2/28/2022
11.0.0-dev.5 117 2/26/2022
11.0.0-dev.4 126 2/24/2022
11.0.0-dev.3 123 2/23/2022
11.0.0-dev.2 129 2/18/2022
11.0.0-dev.1 125 2/7/2022
10.3.0 479 1/18/2022
10.2.0 845 12/3/2021
10.1.0 4,899 11/23/2021
10.1.0-dev.7 188 11/17/2021
10.1.0-dev.6 161 11/16/2021
10.1.0-dev.5 168 11/10/2021
10.1.0-dev.4 159 11/8/2021
10.1.0-dev.3 148 11/8/2021
10.1.0-dev.2 156 11/4/2021
10.1.0-dev.1 160 11/3/2021
10.0.1 406 10/16/2021
10.0.0 363 10/13/2021
10.0.0-dev.4 157 10/13/2021
10.0.0-dev.3 172 10/11/2021
10.0.0-dev.2 214 10/8/2021
9.3.4 422 8/25/2021
9.3.3 372 8/25/2021
9.3.2 360 8/24/2021
9.3.1 370 8/12/2021
9.3.0 388 8/12/2021
9.2.0 405 6/17/2021
9.1.0 382 6/17/2021
9.1.0-dev.8 186 5/26/2021
9.1.0-dev.7 187 5/17/2021
9.1.0-dev.6 184 4/28/2021
9.1.0-dev.5 200 4/23/2021
9.1.0-dev.4 181 4/21/2021
9.1.0-dev.3 189 4/17/2021
9.1.0-dev.2 173 4/12/2021
9.1.0-dev.1 188 4/9/2021
9.0.5 362 3/31/2021
9.0.4 400 3/23/2021
9.0.3 410 3/20/2021
9.0.1 365 3/18/2021
9.0.0 363 3/17/2021
9.0.0-dev.4 188 3/4/2021
9.0.0-dev.3 187 3/1/2021
9.0.0-dev.2 219 2/22/2021
8.4.0 464 11/11/2020
8.3.0 442 10/28/2020
8.2.0 509 10/16/2020
8.1.0 564 9/23/2020
8.0.0 482 7/1/2020
8.0.0-dev.44 306 6/25/2020
8.0.0-dev.43 280 6/23/2020
8.0.0-dev.42 310 6/22/2020
8.0.0-dev.41 309 6/18/2020
8.0.0-dev.40 277 6/18/2020
8.0.0-dev.39 290 6/15/2020
8.0.0-dev.38 393 6/14/2020
8.0.0-dev.37 262 6/13/2020
8.0.0-dev.36 305 6/13/2020
8.0.0-dev.35 245 6/12/2020
8.0.0-dev.34 285 6/12/2020
8.0.0-dev.33 340 6/10/2020
8.0.0-dev.32 261 6/1/2020
8.0.0-dev.31 297 6/1/2020
8.0.0-dev.30 354 5/30/2020
8.0.0-dev.28 301 5/28/2020
8.0.0-dev.27 265 5/15/2020
8.0.0-dev.26 256 5/14/2020
8.0.0-dev.25 284 5/14/2020
8.0.0-dev.24 265 5/13/2020
8.0.0-dev.23 267 5/13/2020
8.0.0-dev.22 264 5/13/2020
8.0.0-dev.21 267 5/12/2020
8.0.0-dev.20 278 5/12/2020
8.0.0-dev.19 276 5/7/2020
8.0.0-dev.18 270 5/7/2020
8.0.0-dev.17 268 5/6/2020
8.0.0-dev.16 265 5/6/2020
8.0.0-dev.15 274 5/5/2020
8.0.0-dev.14 255 5/5/2020
8.0.0-dev.13 285 5/4/2020
7.6.0-dev.13 294 5/1/2020
7.6.0-dev.12 302 4/30/2020
7.6.0-dev.11 268 4/28/2020
7.6.0-dev.10 266 4/27/2020
7.6.0-dev.9 274 4/24/2020
7.6.0-dev.8 273 4/22/2020
7.6.0-dev.7 259 4/15/2020
7.6.0-dev.6 258 4/15/2020
7.6.0-dev.5 256 4/15/2020
7.6.0-dev.4 384 4/11/2020
7.6.0-dev.3 248 4/10/2020
7.6.0-dev.2 252 4/10/2020
7.6.0-dev.1 349 4/8/2020
7.5.2 560 3/20/2020
7.5.1 509 3/12/2020
7.5.0 515 3/10/2020
7.5.0-dev.18 288 3/5/2020
7.5.0-dev.17 289 3/5/2020
7.5.0-dev.16 312 3/4/2020
7.5.0-dev.15 263 3/3/2020
7.5.0-dev.14 268 3/3/2020
7.5.0-dev.13 245 2/29/2020
7.5.0-dev.12 374 2/29/2020
7.5.0-dev.10 359 2/25/2020
7.5.0-dev.9 291 2/20/2020
7.5.0-dev.8 320 2/18/2020
7.5.0-dev.7 254 2/18/2020
7.5.0-dev.6 281 2/14/2020
7.5.0-dev.5 305 2/12/2020
7.5.0-dev.4 264 2/11/2020
7.5.0-dev.3 237 2/11/2020
7.5.0-dev.2 391 2/8/2020
7.5.0-dev.1 282 2/7/2020
7.4.2 474 2/5/2020
7.4.1 543 2/3/2020
7.4.0 570 1/31/2020
7.4.0-dev.4 333 1/31/2020
7.4.0-dev.3 308 1/29/2020
7.4.0-dev.2 257 1/28/2020
7.3.1 551 1/21/2020
7.3.1-preview.7 254 1/21/2020
7.3.1-preview.1 297 1/20/2020
7.3.0 488 1/19/2020
7.2.6 538 1/18/2020
7.2.5 535 12/19/2019
7.2.4 503 12/19/2019
7.2.3 527 12/16/2019
7.2.2 515 12/9/2019
7.2.1 540 12/4/2019
7.2.0 520 11/26/2019
7.2.0-preview.10 260 11/20/2019
7.2.0-preview.9 267 11/19/2019
7.2.0-preview.8 259 11/18/2019
7.2.0-preview.6 279 11/14/2019
7.2.0-preview.5 266 11/14/2019
7.2.0-preview.4 268 11/14/2019
7.2.0-preview.2 270 11/11/2019
7.2.0-preview.1 265 11/9/2019
7.1.0 531 11/6/2019
7.1.0-preview.8 285 11/5/2019
7.1.0-preview.7 264 11/4/2019
7.1.0-preview.6 276 11/1/2019
7.1.0-preview.5 287 10/31/2019
7.1.0-preview.4 293 10/30/2019
7.1.0-preview.3 267 10/26/2019
7.1.0-preview.2 278 10/25/2019
7.1.0-preview.1 265 10/24/2019
7.0.0 552 10/16/2019
7.0.0-rc.41 278 10/15/2019
7.0.0-rc.40 291 10/15/2019
7.0.0-rc.39 276 10/12/2019
7.0.0-rc.38 278 10/11/2019

Please check https://github.com/kephas-software/kephas/releases for the change log.
           Also check the documentation and the samples from https://github.com/kephas-software/kephas/wiki and https://github.com/kephas-software/kephas/tree/master/Samples.