DEV Community

Cover image for Publish a Python Package (Part 4)
datatoinfinity
datatoinfinity

Posted on

Publish a Python Package (Part 4)

Publish to PYPI

go to site: [https://pypi.org]

  1. Create Your Account
  2. Go to Account Setting and scroll down you will see Add API token
  3. Just remember token name should be same as setup.py name. Now from scope select Entire account (all project)
  4. click on create token

  1. Now on your code editor terminal write:
nano ./pypirc

After that write:

[distutils]
index-servers =
    pypi

[pypi]
  username = __token__
  password = "paste created token"

now save it ctrl+o and press enter.
exit ctrl+x.

  1. Now on terminal run.

    twine upload dist/datatoinfinity_hello_package-0.2-py3-none-any.whl --verbose
    
  2. Now on pypi site go to menu and click on you project you will see it.

If any error occur please let me know. It would be helpful for me also.

Top comments (2)

Collapse
 
basirat_ola_0487e58af08dc profile image
Basirat Ola

I honestly don't understand anything on how to publish a python package,can you help me with that?

Collapse
 
datatoinfinity profile image
datatoinfinity

can you explain where are you stuck? creating account or anywhere else?