Introduce an API which can be used to define classes and methods which require some third-party library

[email protected]
Newsgroups gmane.comp.python.twisted.bugs
Message-ID <[email protected]>
New submission from exarkun <[email protected]>:

Twisted has a few external dependencies, generally (but not entirely) in the crypto department.  Where Twisted implementation code meets these external dependencies, we try to fail gracefully.  eg, you can use TCP without having pyOpenSSL installed; some of conch works without PyCrypto, etc.

The way this is done is ad hoc and so inconsistent.  Sometimes the definition of a name will be skipped if a dependency of its implementation is absent.  Sometimes multiple names are defined and one is conditionally selected to be "exported".  Sometimes names are defined conditionally, with the off condition implementation raising an exception.  Sometimes there is an interface which isn't declared if a dependency is missing.

On top of this, tests all have to handle this.  They must try to figure out if some tests cannot succeed because of a missing dependency and then properly skip running the test.  They do this in a variety of ways, most of which are quite error prone (hopefully we will have a buildslave to cover the missing dependencies case soon, but that will only make it easier to catch mistakes earlier).

We should examine our practices, determine their strengths and weaknesses, and codify the best of them somehow.  Where possible, we should introduce helper APIs (most likely decorators, since those are the only obvious things which can be used to control the definition of other things - but we shouldn't necessarily restrict ourselves to decorators) to take out the redundancy and simplify testing.


----------
Type     : enhancement
Component: core
Keywords : 
Priority : high
Nosy     : 
----------
http://twistedmatrix.com/trac/ticket/3828
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.