Skip to content

Instantly share code, notes, and snippets.

@carloshs92
Created June 26, 2014 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carloshs92/ec61f43e66f279e0d5f0 to your computer and use it in GitHub Desktop.
Save carloshs92/ec61f43e66f279e0d5f0 to your computer and use it in GitHub Desktop.
Subir paquetes a Pypi
Create a .pypirc configuration file
[distutils] # this tells distutils what package indexes you can push to
index-servers =
pypi # the live PyPI
[pypi] # authentication details for live PyPI
repository: https://pypi.python.org/pypi
username: {{your_username}}
password: {{your_password}}
Prepare your package
root-dir/ # arbitrary working directory name
setup.py
setup.cfg
LICENSE.txt
README.md
mypackage/
__init__.py
foo.py
bar.py
baz.py
setup.py
from distutils.core import setup
setup(
name = 'mypackage',
packages = ['mypackage'], # this must be the same as the name above
version = '0.1',
description = 'A random test lib',
author = 'Peter Downs',
author_email = 'peterldowns@gmail.com',
url = 'https://github.com/peterldowns/mypackage', # use the URL to the github repo
download_url = 'https://github.com/peterldowns/mypackage/tarball/0.1', # I'll explain this in a second
keywords = ['testing', 'logging', 'example'], # arbitrary keywords
classifiers = [],
)
setup.cfg
[metadata]
description-file = README.md
Then,
python setup.py register -r pypi
python setup.py sdist upload -r pypi
References:
http://peterdowns.com/posts/first-time-with-pypi.html
https://docs.python.org/2/distutils/packageindex.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment