rossant/ipymd

Improve the format registration system

rossant opened this issue · 5 comments

  • Avoid import *
  • Avoid using global variables
  • Load modules dynamically (if possible) and use an on_load() function instead

We're starting down this road over on jupyter/nbviewer#447 and the discussion that brought me here: jupyter/nbviewer#457

I started earlier with my own extension system inspired by some stuff I had cargo culted, but setuptools entry_points will do this better than I can. Here's a good writeup.

basically, your formats would stay, unchanged. Instead of global tomfoolery, they would be registered in setup.py:

entry_points={
    "ipymd.format": [
      "markdown = ipymd.formats.markdown:MARKDOWN_FORMAT",
      ...
    ]
}

and the FormatManager would become... very small. .load would basically become iter_entry_points("ipymd.format").

The real win is for downstream users who run ipymd and ipymd extension, as they would not need to perform any additional configuration... though the received wisdom (from nose, pygments, etc.) is to still require some config, but very simple, as the entry point key becomes the means of integration, not dotted paths: --with-powerpoint.

this sounds really great and much better than the current global mechanism

hopefully i'll find time to get back on this in 3-4 weeks

@bollwyvl let me know if you want to work on this!

I'll give it a shot!

On 04:29, Fri, Jun 12, 2015 Cyrille Rossant notifications@github.com
wrote:

@bollwyvl https://github.com/bollwyvl let me know if you want to work
on this!


Reply to this email directly or view it on GitHub
#35 (comment).

Closed by #55