Where to put data
drsalists at gmail.com
Thu Jan 26 13:15:02 EST 2012
I think that /usr/*/python-whatever/site-packages and related directories
are very much overused in the python world, and tend to cause problems
eventually - EG when you need to install two versions of a program on the
same machine, same interpreter.
I prefer to provide a configure script that accepts --prefix and --python,
and stick stuff under there to be run with that, along with a tiny shell
script in $prefix/bin that adds the "right" directory/directories to the
module path and invokes the "right" python interpreter on the main module -
might be a cpython, pypy or jython.
In short, IMO, if you are installing a general-purpose model (EG a
datastructure module) that you want a lot of code to be able to use without
modifications (only for very stable code), it might be good to add it to
site-packages. If you're installing a program that has program-specific
python modules, why would you put them in site-packages or on a default
search path? Just create a directory for them, and point something at it.
On Wed, Jan 25, 2012 at 9:26 AM, bvdp <bob at mellowood.ca> wrote:
> I'm having a disagreement with a buddy on the packaging of a program we're
> doing in Python. It's got a number of modules and large number of library
> files. The library stuff is data, not code.
> I'd like to put the modules in /usr/lib/pythonX.Y/mymodules or wherever
> setup.py decides. And the data in /usr/share/lib/myprogram.
> My buddy says, that it'll be hard to be consistant in the /usr/share/..
> when we consider platforms other than linux. So, he wants:
> mymodules ...
> mydata ....
> I've got 2 issues with this:
> 1. I don't know if putting data in the python tree is "legit".
> 2. I'd have to do a lot of rewritting. My modules currently use:
> include mymodules.foobar
> and I would need to change that to:
> include myprogram.mymodules.foobar
> unless there is python way to drop the "myprogram" bit?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list