Locating Python modules

pehr anderson pehr at pehr.net
Thu Jul 20 01:29:56 EDT 2000


Dear Simon, 

Distribution Packages Rant:

In the linux world, this problem is pretty much licked.
People build RPM packages which can be installed with 
a single command.  Every machine keeps an RPM database
to track where all the files went and what to do when you
want to uninstall that package.  If differnet platforms
put python in different places, you end up with 
platform specific "binary" RPMS. No big deal.

RPM can even do a nifty verification test to see if 
any of the files have changed.

Of course, if you are stuck in windows world, you have
to suffer the slings and arrows of maintaining *anything*
under windows. The usual method is install everything on 
top of eachother, then when it gets so messy it starts to break, 
reinstall everything from scratch.


No on to the files themselves:

To keep stuff separate, you don't need everything in your
python path. You can include an __init__.py file in the
subdirectory containing your files.  All this file has
to do is include the relevant modules from that dir.
Look at how __init__.py is used within the python
distribution for more detail. It's pretty simple in the base case.
With __init__.py in place, python will be able to find 
modules hidden in your subdirectory off of the default 
pythonpath directory.

	-pehr

Simon Brunning wrote:
> 
> I'd like to organise the Python modules that I have downloaded in some
> rational fashion. Ideally, I'd like a directory to keep them all in, with
> each in a separate sub-directory. I don't want to keep all these directories
> in my PYTHONPATH.
> 
> Is there some de-facto standard way of organising this?
> 
> If not, what methods of organisation do people use, and what are the pros
> and cons of the various methods?
> 
> Cheers,
> Simon Brunning
> TriSystems Ltd.
> sbrunning at trisystems.co.uk
> 
> -----------------------------------------------------------------------
> The information in this email is confidential and may be legally privileged.
> It is intended solely for the addressee. Access to this email by anyone else
> is unauthorised. If you are not the intended recipient, any disclosure,
> copying, distribution, or any action taken or omitted to be taken in
> reliance on it, is prohibited and may be unlawful. TriSystems Ltd. cannot
> accept liability for statements made which are clearly the senders own.



More information about the Python-list mailing list