Python: migrate setup.py “scripts=” to entry_points

只谈情不闲聊 提交于 2019-12-04 01:49:35

I got to a working Scripts\foobar.exe, but it changes more of the code than I wish. I was hoping to get by with just a couple of tweaks to setup.py, or at least something that doesn't mess around inside upstream modules. I don't know it well enough to be sure I'm not getting in the way somehow.

(1) move bin/foobar --> foobartools/foobar_cli.py
(2) In setup.py, comment out #scripts=... and add:

entry_points = {
    'console_scripts': ['foobar = foobartools.foobar_cli:main'],
} 

[later] A refinement of the same core idea, means I keep my fat feet out of the main business area:

(1) move ./bin/foobar --> ./foobar_cli/foobar.py (note extension as well as folder change)
(2) add an empty __init__.py to same folder
(3) console_scripts': ['foobar = foobar_cli.foorbar:main'],

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