nxpd
nxpd copied to clipboard
Suggestions on IPython integration
Wonder if you are interested to migrate the ipyhon intergration to something similar to
https://github.com/rainwoodman/nxsvg/blob/master/src/nxsvg.py#L532
This would get rid of the conditional import in draw_pydot
.
I like it. Do you know if it is easy to specify a priority for the various repr functions? I can imagine that some people might have large graphs and aren't so interested in visualizing them. In those cases, the original repr is better for feedback and it'd be nice to provide a convenient way for people to disable this behavior.
But I remember if a repr_xxx function returns None, Ipython would silently ignore it. If repr_xxx raises an exception, the exception would be issued in the notebook as a warning, and the function is ignored. The final fallback is repr .
For large graphs, we can leave a module-wide parameter for the threshold size of a graph that would be visualized. If the graph is too large, raise a ValueError or something so that the default repr is used.
Enabling and disabling the hook via a dictionary entry is probably not the most convenient API -- after all it takes some 'action' to enable the display hook than a 'configuration'.
For example, in mpld3, the setup is done as a function:
https://mpld3.github.io/modules/API.html#mpld3.enable_notebook https://mpld3.github.io/modules/API.html#mpld3.disable_notebook
The additional setup parameters are passed (for example the threshold) as **kwargs.
That all sounds good.
Sure. I will look into this later of the week.
@rainwoodman Have you had the opportunity put together an implementation for this? No worries if not.
Sorry it fell behind my todo list! Here is a basic version (not yet confirming to the enable/disable api) in issue #6