Dependencies in Python packaging is a confusing issue. For a long time, the only standard was PEP 314, which defines the requires
, provides
and obsoletes
parameters for the distutils.core.setup
function. The elements used for these arguments are the name of the Python module, for example provides=['xml', 'xml.utils']
. PEP was not very versed in standard library dependencies (do I need to depend on Python> = 2.5 or do I need to require 'xml'
?), And as it turned out, there was no tool that used these fields (not even the distutils themselves).
Then came setuptools. He introduced other kinds of dependencies that used project names instead of modules, so for example you can have setup(..., install_requires=['PyXML', 'Pylons'], tests_require=['nose'])
, which is extremely useful : people release software on PyPI using unique project names, and you can use the same names in your script setup, and with easy_install or pip you get these dependencies, modules, scripts and all.
When the reins of distutils were taken a few years ago, the community standardized some ideas on setuptools dependencies for the production of PEP 345, which is now implemented in distutils2, designed to replace distutils and setuptools.
To summarize: - in script settings that are useless, you can have distutils-style-dependent ones - you can have project-level setuppools that are used by setuptools - you can have PEP 345-compatible projec level levels in the setup.cfg
file setup.cfg
used by distutils2
So, in order to answer your question, you must tell us what kind you have. For all practical issues, distutils-style debugging modules should not be used, so it leaves setuptools project descriptors or new 345-style PEPs that are still new and not yet widely used. distutils2 has a compatibility level for setuptools, so it can be used to get the information you want from a setup.py
script based on setuptools.
Not related to packaging tools, there is also a tool that can scan your code to find the modules you use: its module module module, in the standard library, which is not very well known or used, judging by the sad state of its code. This tool will not tell you if the module is used from a stdlib project or from a third-party project, and it cannot specify the name of the project to use in the setup.py
or setup.cfg
.
NTN