2

I've noticed some python projects include setuptools in the list of required modules. My code installs and executes fine without it.

I may be mistaken, but I think the purpose of the install_requires list is to specify the modules needed for execution after installation, not during installation.

Is there some special use-case where it makes sense to install setuptools?

install_requires=[
    'setuptools',
    'requests',
],
Steve
  • 1,064
  • 7
  • 23

1 Answers1

2

If your project makes use of pkg_resources, for example to load resources from entry points, it's run-time dependent on setuptools (which includes the pkg_resources package).

Since Django's setup.py does not include setuptools as a requirement but does make use of pkg_resouces, this can lead to confusion.

Community
  • 1
  • 1
Brecht Machiels
  • 2,562
  • 3
  • 19
  • 35
  • Thank you for answering. If if understand correctly, there are some situations where setuptools is available during installation, but not available in the execution environment, and therefore needs to be installed into the execution environment. – Steve Jan 19 '16 at 14:43
  • If a distribution is installed from a [wheel](https://wheel.readthedocs.org/en/latest/) or an egg, setuptools is not even needed during installation. But of course, if setuptools is uninstalled after installation of the package depending on it, `install_requires` will not be able to do anything about that. – Brecht Machiels Jan 19 '16 at 14:49