problems bundling data with setuptools

I'm having trouble bundling any kind of data (non-Python code) in my egg. Here are the file contents of my source directory: hello.py (cheesy script) README.txt MANIFEST.in (has one line, "include *.txt") setup.py, which looks like: from setuptools import setup, find_packages setup( name = "HelloWorld", version = "0.1", scripts=['hello.py'], include_package_data = True ) I'm creating the egg with python setup.py bdist_egg. I would expect that README.txt should appear in the egg somewhere, but it doesn't. What am I missing? Thanks, Mike ------------------------------------------------------ Michael Hearne mhearne@usgs.gov (303) 273-8620 USGS National Earthquake Information Center 1711 Illinois St. Golden CO 80401 Senior Software Engineer Synergetics, Inc. ------------------------------------------------------

At 09:15 AM 4/30/2008 -0600, Michael Hearne wrote:
I'm having trouble bundling any kind of data (non-Python code) in my egg.
Here are the file contents of my source directory: hello.py (cheesy script) README.txt MANIFEST.in (has one line, "include *.txt") setup.py, which looks like:
from setuptools import setup, find_packages
setup( name = "HelloWorld", version = "0.1", scripts=['hello.py'], include_package_data = True )
I'm creating the egg with python setup.py bdist_egg.
I would expect that README.txt should appear in the egg somewhere, but it doesn't.
What am I missing?
README.txt isn't in a package, so it's not "package data". And MANIFEST.in determines what goes in your *source* distribution, not your binary distribution.

Oh, ok. So is there a way to include data (in a package or not) in my binary distribution? --Mike On Apr 30, 2008, at 9:27 AM, Phillip J. Eby wrote:
At 09:15 AM 4/30/2008 -0600, Michael Hearne wrote:
I'm having trouble bundling any kind of data (non-Python code) in my egg.
Here are the file contents of my source directory: hello.py (cheesy script) README.txt MANIFEST.in (has one line, "include *.txt") setup.py, which looks like:
from setuptools import setup, find_packages
setup( name = "HelloWorld", version = "0.1", scripts=['hello.py'], include_package_data = True )
I'm creating the egg with python setup.py bdist_egg.
I would expect that README.txt should appear in the egg somewhere, but it doesn't.
What am I missing?
README.txt isn't in a package, so it's not "package data". And MANIFEST.in determines what goes in your *source* distribution, not your binary distribution.
------------------------------------------------------ Michael Hearne mhearne@usgs.gov (303) 273-8620 USGS National Earthquake Information Center 1711 Illinois St. Golden CO 80401 Senior Software Engineer Synergetics, Inc. ------------------------------------------------------

At 09:33 AM 4/30/2008 -0600, Michael Hearne wrote:
Oh, ok. So is there a way to include data (in a package or not) in my binary distribution?
See the distutils docs on that. There has been some discussion around creating a standard for including docs and other things in egg metadata, but no concrete proposals have emerged yet. In the meantime, it's important to understand that "eggs are to Python as jars are to Java" -- As far as I know, nobody includes README files, documentation, or any other kind of data in a .jar file, unless it will be used by the code at runtime. In other words, the source distribution is the canonical method of distributing anything that's not used at execution time. And "easy_install --editable" will fetch and unpack source for you, assuming that a source distribution is available. (Unfortunately, many people are only uploading eggs to PyPI, when they should be uploading source distributions, and optionally including eggs if relevant.) Truth be told, there's little reason to upload an .egg to PyPI unless: 1. it contains C code built for OS X or Windows 2. you want it to be able to work with a bootstrapper that lets you import from URLs on sys.path, 3. it's a plugin for a system that allows you to upload or "drop in" eggs to use as plugins. If your project doesn't match these descriptions, there's not really a need for an .egg to be uploaded; easy_install will build one just fine from a source distribution.
participants (2)
-
Michael Hearne
-
Phillip J. Eby