Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding a setuptools command using `entry_points`

Is it possible to add custom setuptools commands to a project by using the entry_points argument to the setup() call?

For example, I've added this to the setup() call of a project:

entry_points = {
    'distutils.commands': [
        'abc = sphinx.setup_command:BuildDoc',
    ],
},

But I still get no abc command when I do python setup.py --help-commands. Any ideas?

https://pythonhosted.org/setuptools/setuptools.html#adding-commands

like image 241
Márcio Avatar asked Oct 31 '22 21:10

Márcio


1 Answers

If your goal is to add a setuptools command to be run via $ python ./setup.py abc I have had success with the following.


import sphinx.setup_command

setup(
  ...

  cmdclass={
      'abc': sphinx.setup_command.BuildDoc
  }, ...
)

See extending distutils here.

like image 121
Dawson Avatar answered Nov 11 '22 08:11

Dawson