[Biopython-dev] Accessing built-in data files

Peter biopython at maubp.freeserve.co.uk
Mon Nov 19 15:25:48 UTC 2007

Tiago Antão wrote:
> 1. Including the data with the distribution
> Biopython uses distutils, a standard Python package mechanism. To
> include data files, setup.py needs to be changed. ...
> Go to DATA_FILES and include your files. For SimCoal I did
> this:
>     #.... More stuff will be here for other packages
>     "Bio/PopGen/SimCoal/data/*par" #my data files are *par
>     ]
> Thats it! Of course, as usual, the package should have been added (but
> that is true to all packages)


> 2. Accessing the data that was packaged
> This one is trickier. The first problem is that the data files might
> be installed in either the platform dependent install directory or in
> the platform independent one. ...

I may be naive here, but I would expect the datafiles to be installed in 
the same relative path as the python files.  Is this not always the case?

As I pointed out in bug 2375, there is some code in setup.py (pre-dating 
the support in distutils) which takes care of installing data files for 
EUtils - if that actually works for the special cases you are concerned 
about, maybe we should just use that for your data files too.  See 

> My work around? Go through all the directories on sys.path (PYTHONPATH) and search for
> a data file that I know is there ...

That doesn't seem very elegant :(


More information about the Biopython-dev mailing list