[Distutils] setuptools docs: Declaring Dependencies

Ian Bicking ianb at colorstudy.com
Thu Sep 22 01:32:09 CEST 2005


Phillip J. Eby wrote:
>> Regarding this:
>>
>> > Note, by the way, that if you declare your dependencies in setup.py,
>> > you do not need to use the require() function in your scripts or
>> > modules, as long as you either install the project or use setup.py
>> > develop to do development work on it. (See "Development Mode" below
>> > for more details on using setup.py develop.)
>>
>> I don't think this is quite true.  In particular, I've noticed if you
>> install a package A --multi-version, it fulfills the requirement for A.
>>   And if you have a package B that requires A, when you require('B')
>> then A will be loaded (added to sys.path, more technically).  But if B
>> is *not* installed --multi-version you can start using it without
>> require()ing it, and A won't have been loaded.
> 
> 
> What I was trying to say was that scripts installed by easy_install or 
> "setup develop" do not require any require()s, as that is handled by the 
> generated wrapper.

You also mention modules there.

>> Given this, I feel like I need to do the basic require()s in my
>> __init__.py.
> 
> 
> I'm not positive that's true.  If you install B without --multi-version, 
> in principle it should de-multi-versionize A as well.  (At least, that's 
> what I'd expect it to do; I'm not 100% sure if it does.  I know for sure 
> it'll do it if "A" isn't installed when you install "B".)  That doesn't 
> mean you can't go back and re-MV-ize "A", but there are always ways for 
> people to break things.

Yes.  But, I'm pretty sure I've done these things (though in retrospect 
it's hard to remember exactly what and in what order).  In part it's 
because of my old sys.path ways.  But I don't think it will be uncommon 
to get in these jams... so, there should be a clear way out.  Not that 
the paragraph above will give a clear way no matter what it says... I 
think better error messages would probably be the best way to make this 
stuff easier.  E.g., version conflict messages could include file paths.

-- 
Ian Bicking  /  ianb at colorstudy.com  /  http://blog.ianbicking.org


More information about the Distutils-SIG mailing list