Add NativeScope for single-base native types - #239
Conversation
Provide a runtime-erased NativeScope base and native_scope decorator for generic identity keys around extension types that cannot support multiple inheritance. Preserve Scope-compatible specialization and add API coverage.
|
Is this still necessary if we properly support 3.12 generics, see #237? |
|
Actually no PEP 695 isn't enough here, as it adds >>> class Test:
... pass
...
>>> class Apple[A](Test):
... pass
...
>>> Apple.__bases__
(<class '__main__.Test'>, <class 'typing.Generic'>) |
|
In other words: Switching |
|
Yeahh, but only if we are doing subclassing with the generics like A function like |
My plan (from close to the time of first Sciline implementation) had been to remove all our use of the |
|
What about generic aliases like type Data[T] = sc.DataArray? |
|
|
That sounds like a reasonable alternative then -- we do not actually want to subclass Scipp types. |
|
How do you want to proceed here then? Should we try to get #237 merged or test out the nanobind version with this PR first? I would prefer minimal and revertable changes first to make sure the nanobinded scipp works out of the box across the stack. I checked easy* code too and couldn't find a place where they do any multi inhertiance and neither in https://github.com/kinisi-dev/kinisi (@jl-wynen mentioned that it's built on top of scipp) |
|
I would prefer to update sciline and the ess packages first. Then we can test the nanobind update with the whole stack again. |
Yes but with this PR or #237? |
|
Some variant of #237 |
Provide a runtime-erased NativeScope base and native_scope decorator for generic identity keys around extension types that cannot support multiple inheritance. Preserve Scope-compatible specialization and add API coverage.