This sample demonstrates stateful Python code registered as a normal scoped C# service:
SessionCounter.dpyprojdeclaresPerSessionstate.- repeated resolutions and calls in one DI scope share Python module globals;
- another DI scope receives independent module globals;
- the scopes are logical state boundaries, not security boundaries.
Run it from the repository root:
dotnet run --project samples/DotPython.PerSession/Consumer/Consumer.csprojThe expected output is 1,2,1.