Difference between entry_points/console_scripts and scripts in setup.py?

前端 未结 4 1316
情歌与酒
情歌与酒 2020-12-12 19:16

There are basically two ways to install Python console scripts to my path by setup.py:

setup(
    ...
    entry_points = {
        \'console_scr         


        
4条回答
  •  心在旅途
    2020-12-12 20:06

    The docs for the (awesome) Click package suggest a few reasons to use entry points instead of scripts, including

    1. cross-platform compatibility and
    2. avoiding having the interpreter assign __name__ to __main__, which could cause code to be imported twice (if another module imports your script)

    Click is a nice way to implement functions for use as entry_points, btw.

提交回复
热议问题