Creating your first pypi
To create your first pip installable package, create a folder and add the following files in there (alternative you can download from here)
The better way to work with pypi package is to use pypi. You can install twine using
pip install twine
Next create a file call setup.py which contains some basic information about your package
from distutils.core import setup
setup(
name = 'kepungmath',
packages = ['kepungmath'], # this must be the same as the name above
version = '0.1',
description = 'A random test lib',
author = 'Jeremy Woo',
author_email = 'kepung@gmail.com',
url = 'https://github.com/appcoreopc/kepungmath', # use the URL to the github repo
download_url = 'https://github.com/appcoreopc/kepungmath/archive/0.1.tar.gz', # I'll explain this in a second
keywords = ['testing', 'logging', 'example'], # arbitrary keywords
classifiers = [],
)
Create another file call setup.cfg
[metadata]
description-file = README.md
python setup.py register -r pypitest
python setup.py register sdist upload -r https://www.python.org/pypitest
You are ready to push to the Test repository with the following command
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
To push to Production repository use the following command
twine upload --repository-url https://upload.pypi.org/legacy/ dist/*
python setup.py register -r pypi
python setup.py register sdist upload -r https://www.python.org/pypi
Try to download it by issuing
pip install kepungmath
Comments