News for hackers. Stuff that matters.
Re:Architecture Notes: Datasette by jrvarela56 on Saturday May 28, 2022 @12:58AM (#31537728)
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.

Re:Architecture Notes: Datasette by simonw on Saturday May 28, 2022 @01:07AM (#31537765)
That'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

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.