Why are most Python dependencies use depends_lib?
Chih-Hsuan Yen
yan12125 at gmail.com
Sat Sep 8 03:08:21 UTC 2018
Ryan Schmidt <ryandesign at macports.org> 於 2018年9月8日 週六 上午5:15寫道:
>
>
>
> 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.
>
Thank you both for explanations and reasoning! As depends_run and
depends_lib are practically the same for Python ports, how about
moving all ports to either depends_lib or depends_run gradually?
Having two patterns hurts my eyes :D
If we are moving to depends_run, just remember to keep non-Python
dependencies in depends_lib for Python packages with C extensions. For
example, in py-openssl, path:lib/libssl.dylib:openssl should be kept
in depends_lib and port:py${python.version}-cryptography and
port:py${python.version}-six can be moved to depends_run.
Regards,
Chih-Hsuan Yen
More information about the macports-dev
mailing list