hughes
hughes

Reputation: 5713

Why does setuptools not create my entry points?

My project directory structure looks like this:

clc
 |-clc
 |  |-__init__.py
 |  |-clc.py
 |  |-main.py
 |-setup.py

main.py looks like this:

def main():
    print "it works!"

in setup.py:

config = {
    ...
    'entry_points':
        'clc_scripts': ['clc = clc.main:main']
    }
}
setup(**config)

When I run python setup.py build, I end up with the following:

running build
running build_py
creating build
creating build/lib
creating build/lib/clc
copying clc/__init__.py -> build/lib/clc
copying clc/clc.py -> build/lib/clc
copying clc/main.py -> build/lib/clc

No bin folder is created, even though I specified an entry point. It does create a file clc.egg-info/entry_points.txt:

$ cat clc.egg-info/entry_points.txt
[clc_scripts]
clc = clc.main:main

Why did setuptools not create my entry point executable file?

Upvotes: 3

Views: 2822

Answers (2)

Ivo
Ivo

Reputation: 5420

Entry point scripts are created at install time, not build time, because they will need to point to the correct location of the installing python's interpreter.

Upvotes: 3

Lukas Graf
Lukas Graf

Reputation: 32590

1) The entry point for generating scripts is called console_scripts.

So fix the name of the entry point in your setup.py like this:

config = {
    ...
    'entry_points':
        'console_scripts': ['clc = clc.main:main']
    }
}

2) Entry points won't get executed when you just build your distribution. They really only make sense for install or develop. Try python setup.py install.

Upvotes: 5

Related Questions