thegreenwebfoundation / carbon-txt-validator

A validator for carbon.txt files, and linked documents in them
1 stars 0 forks source link

Add a plugin system for the validator with an example of it in use #41

Open mrchrisadams opened 2 days ago

mrchrisadams commented 2 days ago

Background

We have discussed builting the carbon-txt validator to:

  1. be a standalone piece of software from the green web platform
  2. have a usable plugin system so that the core logic is something others can use while allowing us some clear places to extend if ourselves

Using a hook based plugin system

After some internal discussion , we've decided to go for a hook based approach. This is the approach used by a number of hugh profile projects.

Both Wordpress and Drupal both have a hook based approach for allowing third party code to hook into existing functionality.

In the python ecosystem, Pytest, the dominant testing framework relies on a popular and battle tested plugin system called Pluggy and there are tens of plugins using this system to refer. Two other open source projects make heavy use of it too Datasette, which has a nice plugins directory and LLM which also has a nice tutorial for making new plugins.

Acceptance criteria

i.e. how will we know when this is done?

Related work and helpful references

https://pluggy.readthedocs.io/en/ https://medium.com/@garzia.luke/developing-plugin-architecture-with-pluggy-8eb7bdba3303 https://docs.datasette.io/en/stable/writing_plugins.html https://simonwillison.net/2022/Aug/17/datasette-lite-plugins/ https://simonwillison.net/tags/plugins/

mrchrisadams commented 2 days ago

Link back to internal trello card: https://trello.com/c/JdqA0nM4/463-create-first-plugin-for-working-with-csrd-doctype-in-carbontxt-files