osmose.engine_cs

The C# engine backend: a .NET library behind one RunSimulation entry point.

Design: docs/superpowers/specs/2026-11-17-csharp-engine-design.md. This package is the Python side. Importing it never loads the CLR (spec section 9.4): the resolution helpers below are pure Python, and only osmose.engine_cs.bridge imports pythonnet, on first use. That keeps the capability check usable in the UI and in processes that later fork, since CoreCLR’s runtime threads do not survive fork.

Functions

assembly_dir()

Directory holding the built assembly: $OSMOSE_CSHARP_ENGINE_DIR, else bin/ here.

clr_hosted()

Whether THIS process hosts the .NET runtime, that is, has loaded the engine.

csharp_engine_available()

Whether the C# engine could be loaded here, and why not.

resolve_dotnet_root()

The .NET installation to host: $DOTNET_ROOT, else ~/.dotnet, else dotnet on PATH (resolved through symlinks).

Modules

bridge

The only module that imports pythonnet (spec sections 9.1 and 9.4).

build

Build the parameter bundle the C# engine runs from (spec section 8.2, plan task 1.2).

bundle

The parameter bundle on the Python side (spec section 8.2, plan task 0.3).

capabilities

Can the C# engine run this config? Fail closed (spec decision D11, plan task 1.1).

engine

CSharpEngine: the third in-process engine (spec section 9.2).

philox

The C# engine's random numbers, reproduced in Python (spec section 5.3, plan task 0.5).

selftest

Self-test of the C# engine for a deployed environment (plan task 1.13, spec section 9.7).