问题
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