Packaging resources with setuptools/distribute?

Have you looked at the setuptools documentation for including package data here: peak.telecommunity.com/DevCenter/setupto....

Have you looked at the setuptools documentation for including package data here: peak.telecommunity.com/DevCenter/setupto... Basically, you just need to set include_package_data=True in your setup. Py file. If you are using subversion or CVS, all versioned files will be included.

If not, you can specify which files to include with a MANIFEST. In file. I believe distribute supports this as well.

You can then access the files as you would without them being packaged. I.e. In main.Py you could have: import os.

Path f = open(os.path. Join(os.path. Dirname(__file__),'templates','file1.

Txt')) print f.read() f.close() and this would work in the packaged version as well. One caveat is that you will have to also set zip_safe = False in setup.Py so that all the files are unzipped during installation.

Excellent, thank you for the help. Would you mind clarifying the difference between "data files" and "resources", as defined by the setuptools documentation you linked to? I was following the instructions for resources, but they appear to be qualitatively different.

Thanks! – chuckharmston Nov 14 '09 at 1:34 Well, your question was the first time I've ever come across "resources" so I too am curious what they are for. But data files are definitely the way to go for stuff like templates.

– pcardune Nov 14 '09 at 5:18 1 Note that you need not use zip_safe=False. Instead, use pkg_resources. Resource_stream('packagename', 'templates/file1.

Txt').read() and setuptools will get the stream for you from the filesystem or from the zipped egg. – Jason R. Coombs Apr 12 '10 at 14:26.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions