3 ms·
Simon thanks for taking the time to explain Datasette internals. Not a Python developer myself, I was intrigued by the use of hooks to extend Datasette and end
by jrvarela56 4y ago
Simon thanks for taking the time to explain Datasette internals.
Not a Python developer myself, I was intrigued by the use of hooks to extend Datasette and ended up looking into pluggy and how Datasette plugins use hooks.
I noticed some Datasette hooks like 'extra_template_vars' override values set by other hooks, while 'extra_body_script' simply append stuff to a list.
How does Datasette avoid plugins clashing with each other? Say one plugin writes a header and another overrides it.
- simonw 4y agoThat's something I'm still figuring out. In particular, I want plugins that add extra content to pages to be able to collaborate with each other. I have an open issue for that here: https://github.com/simonw/datasette/issues/1191 https://github.com/simonw/datasette/issues/1191 I'm not too worried about extra template vars overrides though - that will only be a problem if two plugins accidentally use the same variable name. Maybe I should encourage plugins to use a namespace based on their name in the documentation though.