CyberKeeda In Social Media

How to Upload your Django bundled package to PyPI using twine

Within our last django post, i have demonstrated how we can bundle/package our app into tar.gz format and how we can install it locally.


In case you are not aware, go through the post link.
Within this blog post, we will know cover, how we can upload our django app bundled package into PYPI.
  • Once you have successfully created an account, let's install an additional python package named as twine, open command prompt/terminal and run the below command.
# pip install twine
  • Toggle down to your bundled home directory where you have your bundled tar.gz package under dist folder and run the following command.
# twine check dist/*
Note : PyPI uses your README.rst for to make it's README, descrptions and all other sections under your python package as a part of documentation.
Most of the errors comes while reading your README.rst file from twine as it fails to meet the requirement the formatting required to upload on twine.

In case it gives error, fix the error and try making new bundled package and do run "twine check" to verify if it has been fixed or not.

In order to recreate bundled package, delete old directories (dist and egg-info) and rerun previous command to rebundle it.

# python setup.py sdist
One all errors are fixed, we are ready to upload it on PyPi website, use the below command to upload your package.
# twine upload dist/*
It will ask for your credentials, use the same newly created PYPI account credentials to upload it under your username.
Upon successful upload, we can check our PyPi account, package will be uploaded with formatted description mentioned within our README.rst file.

Our django-filesnow screenshot looks like below screenshot.


No comments:

Post a Comment

Designed By Jackuna