How to add a command hook in setuptools setup?

I am using setuptools version 0.9.6 and want to add a command hook to setup , following the description here or here . I created the MyCommand class derived from setuptools.Command in the same setup.py , and I am trying to add this hook as follows:

 setup( # ... entry_points = { "distutils.commands": [ "my_command = MyCommand"]} ) 

However, the my_command command is not recognized, i.e. python setup.py my_command gives an error

 error: invalid command 'my_command' 

Maybe I need to approach my team differently? Or is there a change in version 0.9.6 used from setuptools ? How to do it right?

+4
source share
1 answer

Add the command to cmdclass, not what I found.

 setup( cmdclass = {'my_command':MyCommand}, ) 

A type:

 >>> python setup.py --help-commands 

List your team in Extra Commands

+5
source

Source: https://habr.com/ru/post/1492871/


All Articles