Search code examples
pythonsetuptoolssetup.pydistutils

setup.py: what is a difference between entry points and cmdclass?


While learning the structure of setup.py, I came across two terms: entry_points and cmdclass.

I read the document of setuptools and distutils. With the help of that, and some information I found online, I came to the conclusion that those two are one and the same. Specifically:

Those two are used to add custom commands, or can be used to add hooks to the existing commands.

But, when I checked the setup.py files of some popular packages, I found that those two properties are being used together. For e.g. see setup.py of numpy package.

Could you explain me the use of those two properties?


Solution

  • cmdclass is a way to modify behaviour of the very setup.py. For example you can override build or install commands to extend them.

    entry_points are similar to scripts, they declares scripts that will be created on installation. Those scripts are intended to run by users.