[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Best way to package a python module which is "private" with exposed calling script



Hello,

What I would like to do is to package a private python package without exposing it's internals. Here is the setup:

* module - This is a module that contains the main code
* script - This is a python script which handles some argument parsing stuff and then imports the module code to do main parts of the work

For example a minimal package example might look like this:

    package/
    ├── module/
    │   └── __init__.py
    ├── scripts/
    │   └── script
    └── setup.py

I know how to package this so that everything is installed to the normal places in the system. However, this allows the user to import it directly from the system interpreter. What I would ideally like is for the module code to be put somewhere off the regular system path and then have the binary "know" how to find it. I know how to hack this sort of thing together (say by hard-coding things using e.g. sys.path), but what I was wondering if there was any "standard" way of doing this that I am unaware of.

If this is the wrong list, then please direct me to a better place. Thanks for any help!

Cheers,
Thomas


Reply to: