-
Notifications
You must be signed in to change notification settings - Fork 1
Pypi and namespace packages
pkienzle edited this page May 25, 2011
·
2 revisions
After some struggle we got pypi and namespace packages to work.
First, a reminder how to use pypi once you've created your account
-
create ~/.pypirc:
[distutils] index-servers = pypi [pypi] username:yyyyy password:******
-
create your namespace path. For example, if you want to import bar as foo.bar:
$ mkdir foo $ cat >foo/__init__.py <<EOF from pkgutil import extend_path __path__ = extend_path(__path__, __name__)
-
update setup.py to include namespaces:
# so python setup.py sdist gets all the files if os.path.exists('MANIFEST'): os.unlink('MANIFEST') import foo.bar setup(... name='foo.bar', version=foo.bar.__version__ package_dir={'foo.bar':'bar'}, packages=['foo','foo.bar'], ...)
See http://docs.python.org/distutils/setupscript.html#additional-meta-data
-
register your package:
$ python setup.py register
-
upload your package:
$ python setup.py sdist upload
-
test your packages:
$ virtualenv test --no-site-packages $ test/bin/pip install foo.bar $ test/bin/python
>>> import foo.bar
When you find out you've uploaded your packages incorrectly, log on to you pypi account and delete the version (not just the file) that you just uploaded, fix the problem, and try again.