In my Python application, I can distinguish between entry points (scripts) and what I think of as library code.
My instinct is to put the library code inside a package, and the scripts elsewhere importing from the package.
It is possible using setup.py to reference methods inside a package to use as entry-points, thereby having all Python code inside packages.
Which is preferable?
Note: this link discusses both options but doesn't really offer an opinion.
Edit: to give a more concrete example, I am reviewing some code which contains one package. There are forty modules inside it:
__init__.py
- 11 'scripts'
- 10 'library modules' used by those scripts
- 18 test modules
This doesn't feel like it is using the capability of packages very well, but I can't put my finger on what exactly is wrong.
I appreciate that having tests in the same package was not in my original question.