zerothi / sisl

Electronic structure Python package for post analysis and large scale tight-binding DFT/NEGF calculations
https://zerothi.github.io/sisl
Mozilla Public License 2.0
173 stars 57 forks source link

Listify breaks documentation #783

Closed pfebrer closed 1 month ago

pfebrer commented 1 month ago

The documentation doesn't build in the current state of the code.

There is some error with Listify, which I don't understand.

Here are the logs: build_docs.log

zerothi commented 1 month ago

Trying to fix this, however, I currently run into:

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Cell In[7], line 1
----> 1 pdos_plot.network.visualize(notebook=True)

File ~/codes/sisl/docs/.venv-docs/lib/python3.11/site-packages/nodify/workflow.py:528, in Network.visualize(self, colorscale, show_workflow_inputs, edge_labels, node_help, notebook, hierarchial, node_props, inputs_props, leafs_props, output_props, to_export)
    488 """Visualize the workflow's network in a plot.
    489 
    490 The nodes of the graph are the node functions that compose the workflow.
   (...)
    525     If None, it is taken from the "NODES_EXPORT_VIS" environment variable.
    526 """
    527 if to_export is None:
--> 528     to_export = get_env_variable("NODES_EXPORT_VIS") != False
    530 net = self.to_pyvis(
    531     colorscale=colorscale,
    532     show_workflow_inputs=show_workflow_inputs,
   (...)
    541     to_export=to_export,
    542 )
    544 return self._show_pyvis(net, notebook=notebook, to_export=to_export)

File ~/codes/sisl/docs/.venv-docs/lib/python3.11/site-packages/nodify/_env.py:61, in get_env_variable(name)
     53 def get_env_variable(name: str):
     54     """Gets the value of a registered environment variable.
     55 
     56     Parameters
   (...)
     59         the name of the environment variable.
     60     """
---> 61     variable = NODES_ENV_VARIABLES[name]
     62     return variable["process"](variable["value"])

KeyError: 'NODES_EXPORT_VIS'

You can ignore this error by setting the following in conf.py:

    nbsphinx_allow_errors = 

in nodify?

pfebrer commented 1 month ago

True, I had fixed it, but forgot to make a release. It should be fixed now :+1:

zerothi commented 1 month ago

Still problems with viz, could you try locally?

rse the inputs. We do this to separate the kwargs from the rest of the inputs.
--> 712 bound = inspect.signature(self.function).bind_partial(**inputs)
    713 inputs = bound.arguments
    715 # Now that we have parsed the inputs, put back the args key (if any).

File /opt/gnu/12.3.0/python/3.11.7/lib/python3.11/inspect.py:3219, in Signature.bind_partial(self, *args, **kwargs)
   3214 def bind_partial(self, /, *args, **kwargs):
   3215     """Get a BoundArguments object, that partially maps the
   3216     passed `args` and `kwargs` to the function's signature.
   3217     Raises `TypeError` if the passed arguments can not be bound.
   3218     """
-> 3219     return self._bind(args, kwargs, partial=True)

File /opt/gnu/12.3.0/python/3.11.7/lib/python3.11/inspect.py:3201, in Signature._bind(self, args, kwargs, partial)
   3199         arguments[kwargs_param.name] = kwargs
   3200     else:
-> 3201         raise TypeError(
   3202             'got an unexpected keyword argument {arg!r}'.format(
   3203                 arg=next(iter(kwargs))))
   3205 return self._bound_arguments_cls(self, arguments)

TypeError: got an unexpected keyword argument 'data'

You can ignore this error by setting the following in conf.py:

    nbsphinx_allow_errors = True
pfebrer commented 1 month ago

Do you know which notebook is this?

zerothi commented 1 month ago

I think it is this one:

Notebook error:
CellExecutionError in visualization/viz_module/showcase/BandsPlot.ipynb:
------------------
spin_texture_plot.update_inputs(
    bands_style={"color": SpinMoment("x"), "width": abs(SpinMoment("x")) * 40}
).update_layout(showlegend=False).show("png")
------------------
pfebrer commented 1 month ago

There was a bug in nodify :) It should be fixed now :+1:

pfebrer commented 1 month ago

But for me it still fails because of Listify:

Extension error (sphinx.ext.autodoc.typehints):
Handler <function record_typehints at 0x7f76b4f59f80> for event 'autodoc-process-signature' threw an exception (exception: Listify can not be used with __wrapped__.)
zerothi commented 1 month ago

Thanks, fixed!