entry_points does not create custom scripts with pip or easy_install in Python?

心已入冬 提交于 2019-12-10 19:10:54

问题


I am using simple entry points to make a custom script, with this in setup.py:

  entry_points = {
           'my_scripts': ['combine_stuff = mypackage.mymod.test:foo']
  }

where mypackage/mymod/test.py contains:

import argh
from argh import arg
@arg("myarg", help="Test arg.")
def foo(myarg):
    print "Got: ", myarg

When I install my package using this (in same directory as setup.py)

pip install --user -e .

The entry points do not get processed at all it seems. Why is that?

If I install with distribute easy_install, like:

easy_install --user -U .

then the entry points get processed and it creates:

$ cat mypackage.egg-info/entry_points.txt 
[my_scripts]
combine_stuff = mypackage.mymod.test:foo

but no actual script called combine_stuff gets placed anywhere in my bin dirs (like ~/.local/bin/). It just doesn't seem to get made. What is going wrong here? How can I get it to make an executable script, and ideally work with pip too?


回答1:


The answer was to use console_scripts instead of my_scripts. It was unclear that the scripts name was anything other than internal label for the programmer.



来源:https://stackoverflow.com/questions/18044645/entry-points-does-not-create-custom-scripts-with-pip-or-easy-install-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!