Hey there, I posted this question on stack overflow, but I think it's a bit too niche for that site and it's better to just ask the hardcore Sphinx users.
------ How can one create a Sphinx directive that creates documentation from an externally defined data structure? For context, I have some classes that automatically create attributes based on a JSON response. class Model: def __init__(self, json_data): self.__dict__ = json_data model = Model({"a": 1}) model.a The issue I'm having is documenting this in Sphinx. I could possibly do it manually like so: .. autoclass:: Model .. attribute:: a However the properties are numerous, outside my control, which presents issues keeping the documentation up to date with the backend. Attempting to remedy this problem I've built up a data-structure pulled from a swagger document that contains information about these dynamic properties. However I have no idea how to apply this in Sphinx. I've looked into custom directives and domains, but without some serious digging into the internals I don't understand how to create a directive that creates *other directives*. In essence I would like to do the following. .. autoclass:: Model .. custom_set_of_attributes_directive:: model_schema Which would be equivalent to: .. autoclass:: Model .. attribute:: a .. attribute:: b .. attribute:: c -- You received this message because you are subscribed to the Google Groups "sphinx-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/58214896-735d-4b47-94d1-9ab2f907e6aeo%40googlegroups.com.