Why are most Python dependencies use depends_lib?

Ryan Schmidt ryandesign at macports.org
Fri Sep 7 21:15:28 UTC 2018



On Sep 7, 2018, at 04:08, Mojca Miklavec wrote:

> On Fri, 7 Sep 2018 at 10:39, Chih-Hsuan Yen wrote:
>> 
>> Hi all,
>> 
>> In many Python libraries, depends_lib is used to store dependencies
>> listed in install_requires of setup.py. According to MacPorts
>> documents, depends_lib is for dependencies that are necessary for both
>> build-time and run-time, and depends_run is for those required in
>> run-time only. For most Python libraries, especially pure Python ones,
>> the build step is just copying Python sources files to a build/
>> directory, and dependencies are not checked. So, the question is: why
>> depends_lib is used in these cases instead of depends_run?
> 
> My speculation is that:
> - long time ago we had no depends_run (or at least I did not know
> about it), so initially everything would be depends_lib anyway

depends_build, depends_lib and depends_run have existed since the beginning.


> - functionally there's absolutely no difference from the perspective
> of the user being able to use a package
> - in many cases nobody bothers checking or fixing those dependencies

There's probably little practical difference, as far as the user is concerned, between depends_lib and depends_run. Either way, MacPorts will arrange that those ports are installed beforehand, and will prevent them from being uninstalled afterward. Still, there's nothing wrong with updating dependency types to be more correct.

It's more important to get the distinction between depends_build and depends_lib/depends_run right. Build dependencies can be uninstalled after the build; library and runtime dependencies can't. 


> - pypi2port would always give you depends_lib (I'm not even sure if
> metainformation in python packages is able to distinguish between the
> two, and even if it is, most python package authors would not bother
> getting this right)
> 
> But note again that this is just my personal **speculation**.

Looks like pypi2port only uses depends_build and depends_run; it does not use depends_lib. Seems to me like that's probably wrong, but I'm not very familiar with python.



More information about the macports-dev mailing list