pkg-resources

Accessing python egg's own metadata

I've produced a python egg using setuptools and would like to access it's metadata at runtime. I currently got working this: import pkg_resources dist = pkg_resources.get_distribution("my_project") print(dist.version) but this would probably work incorrectly if I had multiple versions of the same egg installed. And if I have both inst...

How can I manually register distributions with pkg_resources?

I'm trying to get a package installed on Google App Engine. The package relies rather extensively on pkg_resources, but there's no way to run setup.py on App Engine. There's no platform-specific code in the source, however, so it's no problem to just zip up the source and include those in the system path. And I've gotten a version of ...

Introduction/tutorial to `pkg_resources`

I heard about Distribute's pkg_resources. I want it to organize resources such as images in my project. Is there a good tutorial on how to use it? ...

How can I deal with python eggs for multiple platforms in one location?

We have a common python installation for all of our systems in order to ensure every system has the same python installation and to ease configuration issues. This installation is located on a shared drive. We also have multiple platforms that share this installation. We get around conflicting platform-specific files by setting the --...

pkg_resources not found after installing setuptools

I am trying to compile and install python2.6.4 on Debian 5.0.3 (64bit). I installed using 'make altinstall' as I want to keep python 2.5.2 that comes with Deb5.0 as my default python. Following this, I installed setuptools 0.6c11 using the command 'sudo sh setuptools-0.6c11-py2.6.egg --prefix=/usr/local'. However, after installing when ...

Open file in universal-newline mode when using pkg_resources?

Hi - I am processing a CSV file and have the following working code: reader = csv.reader(open(filename, 'rU'), dialect='excel') header = reader.next() However, to be compatible with elsewhere in the codebase, I need to use a file object using pkg_resources.resource_stream, as follows: fileobj = pkg_resources.resource_stream('foo', 't...