HBNetwork / python-decouple

Strict separation of config from code.
MIT License
2.83k stars 196 forks source link

RFC: Freedom to extend decouple with plugins. #115

Open henriquebastos opened 3 years ago

henriquebastos commented 3 years ago

Over the years, most ppl request adding features to decouple.

I think the API is quite mature and fits well it's purpose.

However 2 areas could be improved:

  1. An easy way to add new Repositories, so you can work with whatever data source you want. It could be either a complex file structure or a remote repository.
  2. An easy way to aggregate useful casts for different frameworks or projects.

My idea is to implement pytest's pluggy into decouple do enable this.

I don't know when I'll be able to code a POC, but I'll leave this issue as a request for comments.

SterlingPeet commented 2 years ago

I do think that pluggy is the way to go, I have rolled my own plugin system for some projects and then switched over to pluggy because it already has the features I needed.

I am actually looking for a configuration tool like python-decouple that will allow me to hook up RPCs to update the configuration parameters during runtime. As a separate RPC request, I would also like to be able to save the current value back into the relevant underlying database.

I have looked around but not quite found something that fits my needs. It seems that python-decouple may be one of the closest options, and I do appreciate the simplicity of it. Perhaps this functionality is more complexity than you want in python-decouple. I am trying to decide if I should attempt to shoehorn my solutions into a project like this, or fork into a new project with slightly different goals.

henriquebastos commented 2 years ago

The behavior you're looking for seems different from how python-decouple works. However, with a proper plugin infrastructure you would have the liberty to do whatever you want on top of it.

If you write a PR (with tests) to add the plugin infrastructure, I would gladly help refactor the code to make that central and enable what you desire.

For me. it is important to keep decouple simple and composable.