Best way to specify path to binary for a wrapper module
Question: I write a module that wraps functionality of an external binary.

For example, I wrap `ls` program into a python module `my_wrapper.py`

    
    
    import my_wrapper
    print my_wrapper.ls('some_directory/')
    # list files in some_directory
    

and in my_wrapper.py I do:

    
    
    # my_wrapper.py
    
    PATH_TO_LS = '/bin/ls'
    
    def ls(path):
        proc = subprocess.Popen([PATH_TO_LS, path], ...)
        ...
        return paths
    

(of course, I do not wrap `ls` but some other binary)

The binary might be installed with an arbitrary location, like `/usr/bin/`,
`/opt/` or even at the same place as the python script (`./binaries/`)

**Question:**

What would be the cleanest (from the user perspective) way to set the path to
the binary?

  * Should the user specify `my_wrapper.PATH_TO_LS = ...` or invoke some `my_wrapper.set_binary_path(path)` at the beginning of his script?
  * Maybe it would be better to specify it in `env`, and the wrapper would find it with `os.environ`?
  * If the wrapper is distributed as egg, can I require during the installation, that the executable is already present in the system (see below)?

egg example:

    
    
    # setup.py
    setup(
        name='my_wrapper',
        requires_binaries=['the_binary'] # <--- require that the binary is already 
                                         #      installed and on visible
                                         #      on execution path
    )
    

or

    
    
    easy_install my_wrapper BINARY_PATH=/usr/local/bin/the_binary
    


Answer: Create a "configuration object" with sane defaults. Allow the consumer to
modify the values as appropriate. Accept a configuration object instance to
your functions, taking the one you created by default.

