My last two blog posts on egg-related topics had a title prefix of “easy_install tip”. This post is related, but since it’s handled with setuptools rather than easy_install, I’m prefixing it accordingly.

Have you ever wondered how various packages you install put scripts into your path, such as into /usr/bin? If they’re using setuptools to define their package, then they may be using a script entry point. Here is an example taken and modified from a toy setup.py I have sitting around:

    entry_points = {
        'console_scripts': [
            'my_wonderful_script = my_wonderful_module:my_wonderful_function',
        ]
    },

If you run

python setup.py install

, it will create a script named “my_wonderful_script” in your scripts directory. On Linux, this is typically the same directory that the Python executable itself is in. If you’re on Windows, this is a directory that looks something like C:\Python25\scripts. When you run the generated script, it will call `my_wonderful_function` from the module `my_wonderful_module`. This is something that is really easy to setup and can come in very handy. Next time, I’ll write about how to control where stuff goes when you easy_install it. I guess we’ll be back to the “easy_install” tip prefix.