mitmproxy/mitmproxy — pull request #233 by mhils (2014-03-09 21:17:28+00:00)
Title: Untangle circular dependencies

Hi Aldo,

We currently have quite a few circular imports in the codebase that are tolerated by Python's implicit relative imports. Apart from the idea that circular imports are usually a bad practice, we have two other reasons why we should fix that:

1. implicit relative imports are disabled in Python 3. Sooner or later, we want to change every `import flow` to `from . import flow`. If you do this now, Python complains about the circular imports we have.
2. implicit relative imports don't work with submodules. the tcp_proxy branch introduced the `libmproxy.protocol` submodule which made it neccessary to add import statements in the middle of some files as a temporary workaround - something we definitely want to avoid.

Here's a first attempt to untangle what we currently have in mitmproxy.
More specifically, this PR splits up `libmproxy.proxy` into
- `libmproxy.proxy.config`
- `libmproxy.proxy.connection`
- `libmproxy.proxy.primitives`
- `libmproxy.proxy.server`

Are you okay with these changes? If you'd like any other conventions, let me know. Otherwise, I'm happy to go on here.

Cheers,
Max