Annoy Index Architecture (Inheritance Diagrams)#

This page shows the class inheritance structure for the Annoy backend and the high-level Index facade, using Sphinx’s built-in inheritance diagram support (the same approach used in Matplotlib’s docs).

Note

Enable the extension and ensure Graphviz is available:

extensions += ["sphinx.ext.inheritance_diagram"]

The directive renders via Graphviz (dot). Install Graphviz in your build environment if it is missing.

Index + backend + mixins (public view)#

Inheritance diagram of scikitplot.cexternals._annoy.Annoy, scikitplot.annoy.Index, scikitplot.annoy._mixins._meta.MetaMixin, scikitplot.annoy._mixins._io.IndexIOMixin, scikitplot.annoy._mixins._pickle.PickleMixin, scikitplot.annoy._mixins._vectors.VectorOpsMixin, scikitplot.annoy._mixins._ndarray.NDArrayMixin, scikitplot.annoy._mixins._plotting.PlottingMixin

Reading this diagram

  • Annoy is the low-level C-extension backend and owns the actual index state and core operations.

  • Index is the Python facade that subclasses the backend and composes behavior using independent mixins.

Mixins only (independence + MRO scan)#

This diagram focuses only on the mixins so you can quickly confirm there is no unexpected inheritance between mixins (they should be independent).

Inheritance diagram of scikitplot.annoy._mixins._meta.MetaMixin, scikitplot.annoy._mixins._io.IndexIOMixin, scikitplot.annoy._mixins._pickle.PickleMixin, scikitplot.annoy._mixins._vectors.VectorOpsMixin, scikitplot.annoy._mixins._ndarray.NDArrayMixin, scikitplot.annoy._mixins._plotting.PlottingMixin

Notes and limitations#

Inheritance diagrams show class derivation, but they do not show composition relationships (e.g., an optional self._annoy backend attribute). For composition support, refer to the “glue” helpers documented elsewhere (e.g., backend_for(self), lock_for(self)).

See Also#

  • sphinx.ext.inheritance_diagram

  • Graphviz (dot) documentation