ssato / python-anyconfig

Python library provides common APIs to load and dump configuration files in various formats
MIT License
278 stars 31 forks source link

Add APIs to register / unregister custom parser classes #52

Closed ssato closed 6 years ago

ssato commented 8 years ago

Currently, anyconfig initialize the list of configuration file parsers (classes) at first and it's static. It should be nice if it has a couple of APIs to register and unregister custom parsers later dynamically.

txomon commented 8 years ago

Just in case, instead of registering-unregistering custom parser classes, you can use setuptools' entry_point clause to automatically extend your parser pool.

Some examples using this technique can be found in pytest, and trac.

ssato commented 8 years ago

Thanks for your advice!

Actually, I'm already tried setuptools plugin mechanism: https://github.com/ssato/python-anyconfig/blob/master/anyconfig/backends.py#L65 . I feel it's hard to test and not easy to understand. So I am planning to add another one, explicit register/unregister-ing APIs.

ssato commented 6 years ago

I added and made some pluggable backend modules work.

And ATM, plugin mechanism provided by setuptools look fine enough for my usecase so that I close this issue.