Widgets in Hubs have an interface they are expected to implement. This
formally defines and documents this interface as Sphinx docblocks in
code. The docblocks are then rendered to HTML using the Sphinx autodoc
plugin as part of a new API section of the documentation project. This
replaces the separate API documentation for widgets originally found in
the dev guide. This has the advantage of creating a single source of
truth for API documentation.
This commit does introduce a new Widget class to define the
interface. It should function in the same way as the widgets currently
defined at the module level and truthfully only serves to bundle the
interface into one neat object within the module.
I'm interested to hear what people think about implementing widgets as modules
or as classes. They're pretty much equivalent and both approaches should work,
but we should pick one way or the other and document it. If we want to use the
module approach, I can probably move the docblocks around and fiddle with sphinx
a bit to make the documentation still work and make sense.
To get a good idea of what this looks like, just build the docs with make html and then
navigate to the api.html page.
Widgets in Hubs have an interface they are expected to implement. This
formally defines and documents this interface as Sphinx docblocks in
code. The docblocks are then rendered to HTML using the Sphinx autodoc
plugin as part of a new API section of the documentation project. This
replaces the separate API documentation for widgets originally found in
the dev guide. This has the advantage of creating a single source of
truth for API documentation.
This commit does introduce a new
Widgetclass to define theinterface. It should function in the same way as the widgets currently
defined at the module level and truthfully only serves to bundle the
interface into one neat object within the module.
I'm interested to hear what people think about implementing widgets as modules
or as classes. They're pretty much equivalent and both approaches should work,
but we should pick one way or the other and document it. If we want to use the
module approach, I can probably move the docblocks around and fiddle with sphinx
a bit to make the documentation still work and make sense.
To get a good idea of what this looks like, just build the docs with
make htmland thennavigate to the
api.htmlpage.Signed-off-by: Jeremy Cline jeremy@jcline.org