Yelp / zygote

A Python HTTP process management utility.
http://opensource.yelp.com/
Apache License 2.0
40 stars 15 forks source link

Fixes up things to make installable from PyPI #62

Closed davidselassie closed 10 years ago

davidselassie commented 10 years ago

If I try to install zygote from PyPI using version 0.5.2, it doesn't work because setup.py is defining the package using itself; this will only work if there's another version lying around. I get the following in a fresh virtualenv:

$ pip install zygote -v
Downloading/unpacking zygote
  Using version 0.5.2 (newest of versions: 0.5.2, 0.5, 0.4, 0.3)
  Downloading zygote-0.5.2.tar.gz
  Downloading from URL https://pypi.python.org/packages/source/z/zygote/zygote-0.5.2.tar.gz#md5=a976a42f3e843a6a0553e617005d4ac8 (from https://pypi.python.org/simple/zygote/)
  Running setup.py egg_info for package zygote
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/nail/home/dselassi/zygote/TEST/build/zygote/setup.py", line 4, in <module>
        from zygote import version
    ImportError: No module named zygote
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 16, in <module>

  File "/nail/home/dselassi/zygote/TEST/build/zygote/setup.py", line 4, in <module>

    from zygote import version

ImportError: No module named zygote

----------------------------------------

I followed the advice of http://stackoverflow.com/questions/2058802/how-can-i-get-the-version-defined-in-setup-py-setuptools-in-my-package . If I tell pip to look at a local sdist I just made of this new version 0.5.3, it works:

~/zygote(version-in-setup)$ pip install zygote -f ./dist/ -v
Downloading/unpacking zygote
  Local files found: /nail/home/dselassi/zygote/dist/zygote-0.5.3.tar.gz
  Using version 0.5.3 (newest of versions: 0.5.3, 0.5.2, 0.5, 0.4, 0.3)
  Running setup.py egg_info for package zygote
    running egg_info
    creating pip-egg-info/zygote.egg-info
    writing requirements to pip-egg-info/zygote.egg-info/requires.txt
    writing pip-egg-info/zygote.egg-info/PKG-INFO
    writing top-level names to pip-egg-info/zygote.egg-info/top_level.txt
    writing dependency_links to pip-egg-info/zygote.egg-info/dependency_links.txt
    writing entry points to pip-egg-info/zygote.egg-info/entry_points.txt
    writing manifest file 'pip-egg-info/zygote.egg-info/SOURCES.txt'
    warning: manifest_maker: standard file '-c' not found
    reading manifest file 'pip-egg-info/zygote.egg-info/SOURCES.txt'
    writing manifest file 'pip-egg-info/zygote.egg-info/SOURCES.txt'
Requirement already satisfied (use --upgrade to upgrade): setuptools in ./TEST/lib/python2.6/site-packages (from zygote)
Downloading/unpacking tornado (from zygote)
...

We also have to actually declare the package in setup.py so it will be bundled up in the dists. This was confirmed by looking in the sdist tarball.

We also have to add the static non-Python files to a manifest so they will be packaged up. Updates the way the paths to those static assets were discovered to use pkg_resources.resource_filename. I tested this by installing this version via pip in another project and was able to view the status page.