Basic Packaging strategy question

ddbug pavel.aronsky at gmail.com
Sat Mar 4 21:50:00 EST 2017


On Sunday, March 5, 2017 at 1:08:25 AM UTC+2, bilm... at gmail.com wrote:
> I have a simple project that I want to package to put it on another machine but everything I have read so far about packaging ends up putting the whole install alongside  with 'packages' - typically in .../site-packages. 
> This seems a strange place to launch an app from!
 
If your target OS is Windows - this is the question I have for long time without any good answer
(see this thread: https://groups.google.com/forum/#!topic/comp.lang.python/Gwx6HA83bUE )

There is a zillion ways to specify modules search path, but no good options on Windows to place entry points. One cannot consider dropping entry points in obscure places where user cannot find them, as good. Since on Linux this is not an issue (or much lesser issue) it can be viewed as one of deficiencies of Windows - but otherwise Python has 1st class support for Windows, including the cute py launcher.

> So, if I have an app with a main.py entry point is it ok for everything to be in .../site-packages/myproject?

Nope, site-packages is the place for modules. You're asking about entry points. 

> Or, should I put everything except main.py in a package and then copy main.py wherever I want and use PIP to install the package containing the rest of the app?
>  
> simple example which ends up with needing to run:
>  python /usr/local/lib/site_packages/myproject/main.py:

Placing scripts under modules location is an option, and setuptools can automatically create 'entry points' that bootstrap the actual scripts.
But this does not solve the root issue - where to place these entry points?
 
I have not found a good solution yet.

Regards,

ddbug


More information about the Python-list mailing list