Speaking as pylint maintainer, but certainly not on behalf of all Python linters:
I think we would prefer a JSON file.
We currently implement this with the following code:
We would probably just parse the JSON file into this format whenever some user notifies us that it is outdated or we ourselves note this. (Or change our code to parse the JSON, but that is probably more effort. Perhaps a good first issue?
)
The issue with the API is that we’re just too reliant on the Python interpreter the user is running. This will probably cause a lot of confusion for (newer) users and also makes it so that pylint behaves differently on different interpreters. That last point is unavoidable to some degree, but if we can avoid it (by just hardcoding data instead of relying on the interpreter) we tend to go that route.