# Ticket #9800 (new defect)

Opened 1 year ago

## setup.py does not declare install_requires dependencies

Reported by: Assigned to: willmerae osimons low XmlRpcPlugin normal olemis, rjollos, bobbysmith007, hasienda 0.11

### Description

TracXMLRPC requires Trac and Genshi, but it doesn't declare this. The following lines should be added to setup.py

    install_requires=[
'Genshi',
'Trac',
],


## Change History

### 02/14/12 20:36:55 changed by rjollos

• cc changed from olemis to olemis, rjollos.

### (follow-up: ↓ 3 ) 02/14/12 23:09:51 changed by bobbysmith007

• cc changed from olemis, rjollos to olemis, rjollos, bobbysmith007.

Please see some of the comments on #9793.

The problem I had when using install_requires, is that if I had trac 11 installed but tried to install a plugin that required trac 12 , it would download and install trac12 from pipy (which is probably not what the user indended). In similar cases it would be nice to either prompt or fail outright. It would be nice if the trac 11 plugins required trac11 etc, but I have yet to find a way to do this with setuptools unfortunately.

As an aside, why would you be installing TracXMLRPC without installing trac? Or was this intended as a rapid install process of trac? (It seems odd to me that anyone would have wanted to install trac this way, but reasonable to enforce those requirements (ie fail to install if they were unmet)).

Cheers, Russ

### (in reply to: ↑ 2 ) 02/14/12 23:16:59 changed by rjollos

In similar cases it would be nice to either prompt or fail outright. It would be nice if the trac 11 plugins required trac11 etc, but I have yet to find a way to do this with setuptools unfortunately.

Same here. I've also had other problems (#7986) when trying to enforce dependencies through setup.py.

### (follow-up: ↓ 10 ) 02/15/12 10:05:28 changed by osimons

Seems like the 'Nay's have it. Doing development and any form of work with the source code, it is all too easy to have downloads start. I don't like that either.

(BTW, if using install_requires there is no need to declare both Trac and Genshi as Trac already declares Genshi as a dependency)

In a way the plugin requires Trac, but on the other hand it is perfectly valid to install the plugin and install Trac later - it is technically not required for setup or install, it is only required for later operation.

That said, I have often considered implementing a better solution. Particularly related to versioning. The idea I've considered is this non-obtrusive block at the start of setup.py that just checks versions IF Trac is installed:

import sys
version = '1.1.2'
# Check Trac version if installed
try:
import trac
if trac.__version__ < '0.11':
print "RPC %s requires Trac >= 0.11" % version
sys.exit(1)
except ImportError:
pass


### 02/15/12 10:32:24 changed by willmerae

Thanks for the quick responses. I raised the ticket just because it seemed good metadata to have. I hadn't considered side effects of declaring install_requires, but I see what you mean - our build scripts specifically disable all downloads by setuptools to avoid the same issue.

I proposed Genshi as well as Trac because the source:xmlrpcplugin/trunk/tracrpc/ticket.py explicitly imports it.

### 02/16/12 10:32:38 changed by willmerae

To clarify - I'm happy for this ticket to be closed wontfix or invalid

### (follow-up: ↓ 8 ) 02/16/12 10:47:42 changed by osimons

Yeah, I know. I'm just keeping it open as a reminder to perhaps try my non-obtrusive check. It would catch a class of errors that result from trying to install plugin with a non-supported Trac version.

Having a plugin automagically install Trac is likely something I'll never do, so in that respect this ticket is a wontfix. Trac should preferably be installed the 'right' way first, before installing the plugins.

### (in reply to: ↑ 7 ) 02/16/12 22:21:41 changed by rjollos

• cc changed from olemis, rjollos, bobbysmith007 to olemis, rjollos, bobbysmith007, hasienda.

Yeah, I know. I'm just keeping it open as a reminder to perhaps try my non-obtrusive check. It would catch a class of errors that result from trying to install plugin with a non-supported Trac version.

I'm really interested in finding a good solution for this as well, so I'll post here if I find some time to experiment, and look forward to your findings.

### 09/21/12 05:19:53 changed by rjollos

(In [12040]) Refs #9800, #10331: Added minimum required Trac version.

### (in reply to: ↑ 4 ) 09/21/12 05:24:21 changed by rjollos

That said, I have often considered implementing a better solution. Particularly related to versioning. The idea I've considered is this non-obtrusive block at the start of setup.py that just checks versions IF Trac is installed:

Do you think there is a significant number of instances in which someone will be building an egg in an environment that Trac is not installed? In [12040], I took that approach of exiting when Trac is not found.

### 09/26/12 03:51:35 changed by rjollos

(In [12057]) Fixes #9963, Refs #9800, #8276, #8803, #9146: Added check in setup.py for minimum required Python version. Python 2.5 is currently required. Later, we'll aim to restore full Python 2.4 compatibility.

### 10/02/12 22:53:14 changed by rjollos

In [12098/ticketdeleteplugin/0.11/ticketdelete/__init__.py], I moved a Trac version check for the TicketDeletePlugin into __init__.py. This keeps the setup.py cleaner and more readable. The function currently only handles the < case, but it would be straightforward to extend it. I'd like to put the code into a module that can be shared around trac-hacks, even if only for the plugins I maintain. One idea is to include this via an svn:external, but I think it would not be included in the downloaded zip files. I'll have to investigate further. Is there any option other than using an svn:external?

### Add/Change #9800 (setup.py does not declare install_requires dependencies)

Change Properties