Closed ssato closed 6 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.
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.
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.
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.