id	summary	reporter	owner	description	type	status	priority	milestone	component	resolution	keywords	cc	branch	branch_author	launchpad_bug
4438	declare dependencies explicitly when we add them	zooko		"Please start considering the addition of a dependency ''without'' the addition of an explicit declaration of that dependency in our Python packaging metadata to be a regression in Twisted. The Tahoe-LAFS v1.6 build worked when Twisted-8.2 was the most current version of Twisted, but when Twisted-9.0 came out with [27079] in it, then the Tahoe-LAFS v1.6 build broke. We can work around this in Tahoe-LAFS by adding pyasn1 to the list of dependencies of Tahoe-LAFS v1.7.

This is a suboptimal work-around:

Tahoe-LAFS itself doesn't depend on pyasn1. If the version of Twisted that is installed is < 9.0 then pyasn1 isn't needed at all, but there is no clean way to express that, so when Tahoe-LAFS v1.7 comes out it will have a hard dependency on pyasn1 even if that dependency isn't needed for the version of Twisted that is installed. Likewise, if Twisted 11.0 comes out next year using a different library instead of pyasn1, then unfortunately people who install Tahoe-LAFS v1.7 with Twisted 11.0 are still going to be getting the hard dependency on pyasn1 even though at that point it will no longer be needed.

The right way to manage this stuff is for Tahoe-LAFS to declare that it depends on Twisted and in particular on the extra ""conch"" feature of Twisted and for Twisted to declare that if you are going to use its extra ""conch"" feature then it depends on pycrypto and pyasn1.

Here is a patch (untested) to Twisted's setup.py that does this:

{{{
Index: setup.py
===================================================================
--- setup.py    (revision 26987)
+++ setup.py    (working copy)
@@ -78,6 +79,13 @@
     if 'setuptools' in sys.modules:
         from pkg_resources import parse_requirements
         requirements = [""zope.interface""]
+        extras_requirements = {}
+        if sys.platform == 'win32':
+            extras_requirements['process_management'] = ['pywin32']
+            extras_requirements['iocp_reactor'] = ['pywin32']
+            extras_requirements['conch'] = ['pycrypto', 'pyasn1']
+        else:
+            extras_requirements['process_management'] = []
+            extras_requirements['iocp_reactor'] = []
+            extras_requirements['conch'] = []
         try:
             list(parse_requirements(requirements))
         except:
@@ -87,8 +95,18 @@
 """"""
         else:
             setup_args['install_requires'] = requirements
+            setup_args['extras_require'] = extras_requirements
         setup_args['include_package_data'] = True
         setup_args['zip_safe'] = False
}}}

See also #3696 and #3238.

The current blocker for #3238 is how to write an automated test of this behavior. I understand how to do that in principle, and we have automated tests of this sort of thing in the Tahoe-LAFS buildbot, but I don't have full access to the source code of the Twisted buildbot so it is hard for me to write tests of this functionality for Twisted: http://twistedmatrix.com/trac/ticket/3238#comment:24"	enhancement	closed	normal		core	invalid		zooko@…			
