Hacker News new | ask | show | jobs
by Karunamon 3254 days ago
The registration is handled by the contents of the tuple in setup.py. Specifically:

    from setuptools import setup

    setup(
        name='snek',
            entry_points={
            'console_scripts': [
                'snek = snek:main',
            ],
        }
    )
It's using the setuptools module, and passing a tuple to it - which is used to create executables for the individual scripts once installed.

https://packaging.python.org/tutorials/distributing-packages...

Specifically, "entry_points" in the setup tuple is what sets the name of the created files and links them to your code. In the example, the executable 'snek' points to main() in snek.py.

Once your package is installed, pip or easy_install handles the magic of putting those files in place. There are boatloads of other options available (much like any packaging system), but this is a minimum viable example.