Fix Version/s: None
Component/s: daf_butler, sphgeom
The support for duck-typed pixelization was lost in w.2021.42 daf_butler with the addition of the type assertion in SkyPixConstructionVisitor's visit method:
assert issubclass(PixelizationClass, Pixelization)
We've been relying on duck-typed Pixelization class for HEALPix pixelization. (This way Pixelization with the tiles approximated by ConvexPolygon can be implemented completely in Python.)
If I understood correctly your ABCMeta.register suggestion, I should be able to try it in my code first. If it works, we can add it to sphgeom.
The assumption is that we do not use Pixelization methods in C++, right?
My suggestion is:
- Define a python PixelizationABC that defines all the methods in Pixelization but as unimplemented abstract methods.
- In your python class you inherit from this ABC
- In sphgeom python/lsst/sphgeom/_init_.py add a ABCMeta.register to associate Pixelization with that PixelizationABC.
- In butler we assert that the pixelization class is a subclass of the PixelizationABC.
The issue was resolved by adding PixelizationABC to lsst.sphgeom package following the recommendation of Tim Jenness
Relevant pull requests:
I've backported and merged this ticket to v23, to support
Here is what pybind11 docs says on this subject: https://pybind11-jagerman.readthedocs.io/en/stable/advanced.html#overriding-virtual-functions-in-python