Skip to content

[docs] Fix class links

Vicentini Filippo requested to merge pv/links into master

Created by: PhilipVinc

Right now links to different classes on netket docs are mostly broken (see for example here https://www.netket.org/docs/_generated/operator/netket.operator.LocalOperator.html and try to click on the base class).

I randomly found out why recently. The reason is that when you have an __init__ file that imports classes from other files (like it's customary), this breaks sphinx module detection.

The workaround is to edit the field __module__, like netket.graph.AbstractGraph.__module__ which defaults to netket.graph.abstractgraph (because the class is defined in that file) and change it to netket.graph.

To make this work, I use a bit of an hack: I add a small piece of code to every module definition that defines __all__ with all the names we want to export

Merge request reports