I'm struggling with my first Python package + script project using setuptools. Here's a skeleton of my setup.py:
setuptools.setup(
name=<PROJECT>,
packages=[<PACKAGE_NAME>],
scripts=['bin/<PACKAGE_NAME>.py'],
python_requires='>=3',
)
My package is in package_name/ and my script, which has the same base name as the package, is in bin/package_name.py. The script does from package_name import *. There are no dependencies.
When I run python3 setup.py install, it succeeds. Thereafter, when I do import package_name in a Python console, it succeeds. But when I run the script from the command line, it fails with a NameError on the first reference to a component from the package. I've reproduced the same error on Mac OS X and Linux.
Why does it fail this way, but doesn't throw an ImportError? How can I fix my script or my setup.py?