python-consul icon indicating copy to clipboard operation
python-consul copied to clipboard

Thinking: Refactoring consul/base.py

Open cruatta opened this issue 9 years ago • 5 comments

Any thoughts about refactoring the classes in base.py it into separate modules? Is this something you'd like to see @cablehead?

cruatta avatar Sep 19 '15 20:09 cruatta

Yeah, it's not too unruly for my subjective tastes, but it's definitely on the edge. We're at 1740 lines now. You're thinking split it by top level endpoint? kv, event, etc?

Pros would be it'd easier to focus on a given endpoint. Con would be it'd be harder to do an entire API sweep to check things are consistent.

cablehead avatar Oct 18 '15 16:10 cablehead

I think the time has come to make this split.

I'm thinking:

  1. make the spilt by top level endpoint name
  2. think through if there's something we could do with broadly common parameters to have them applied consistently, and succinctly, so you can see at a glance they've been applied to an endpoint. challenge for this one is to do it in a way that isn't verbose, but doesn't involve magic.

BTW @cruatta you've been one of the best contributors for this project. Would you be interested in having admin access to be able to help maintain it going forward? @abn is also a maintainer now and it's been great to have the project keep moving forward when I'm unavailable.

cablehead avatar Jul 02 '16 22:07 cablehead

An example of where it's currently easy for endpoints do not get consistent treatment: https://github.com/cablehead/python-consul/issues/116

cablehead avatar Jul 02 '16 23:07 cablehead

Hey thanks Andy! I can't promise that I have a lot of free time but I'd be glad to help in any way I can, including putting some time towards the split.

cruatta avatar Jul 05 '16 23:07 cruatta

This is just awful. I hate magic. But just brain storming ways to make it easy to consistently and explicitly apply parameters - while preserving method signature and docstrings for help and autodoc: https://gist.github.com/cablehead/7fc6d015a3a0c58d7ffdf50df9aaed0d

cablehead avatar Jul 06 '16 17:07 cablehead