Cleanup of pyptlib internals
The current code has a few issues:
- parses config for every method call
- uses implicit global state (awkward to test)
- writes unconditionally to stdout (awkward to test)
- mixes config logic with write/decision logic
- inconsistent method names (writeMethod vs reportSuccess)
My refactoring deals with these issues. Currently it preserves the current API but deprecates it in favour of the new API and documents an easy transition path.
https://github.com/infinity0/pyptlib/compare/master...api-config
Old API (still supported; marked deprecated):
pyptlib.client.init(transports)
pyptlib.client.reportSuccess(...)
pyptlib.client.reportEnd()
New API:
client = pyptlib.client.ClientTransportPlugin.fromEnv()
client.init(transports)
client.reportMethodSuccess(...)
client.reportMethodsEnd()
Similar sort of thing for the server.