PyPi
Install and upgrade some requirements
pip install pip setuptools twine --upgrade
Create accounts
On PyPI Live and also on PyPI Test. You must create an account in order to be able to upload your code. I recommend using the same email/password for both accounts, just to make your life easier when it comes time to push.
Create .pypirc file
Create a .pypirc file in your home with the following content
[distutils]
index-servers =
pypi
pypitest
[pypi]
username=your_username
password=your_password
[pypitest]
repository:https://test.pypi.org/legacy/
username=your_username
password=your_password
Change permissions for other users
chmod 600 ~/.pypirc
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 = 'Miquel Perello Nieto',
author_email = 'perello.nieto@gmail.com',
url = 'https://github.com/perellonieto/mypackage',
download_url = 'https://github.com/perellonieto/mypackage/archive/0.1.tar.gz',
keywords = ['testing', 'logging', 'example'], # arbitrary keywords
classifiers = [],
)
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 = 'Miquel Perello Nieto',
author_email = 'perello.nieto@gmail.com',
url = 'https://github.com/perellonieto/mypackage',
download_url = 'https://github.com/perellonieto/mypackage/archive/0.1.tar.gz',
keywords = ['testing', 'logging', 'example'], # arbitrary keywords
classifiers = [],
)
Tag the git repo
git tag 0.1 -m "Adds a tag so that we can put this on PyPI."
git push --tags origin master
setup.cfg
[metadata]
description-file = README.md
Upload to PyPI test
python setup.py register -r pypitest
python setup.py sdist upload -r pypitest
Upload to PyPI
twine upload dist/mypackage-0.1.tar.gz
No hay comentarios:
Publicar un comentario