DEV Community

Cover image for Python Checklist: Publishing a package to PyPi

Python Checklist: Publishing a package to PyPi

Prahlad Yeri
Most programmers like coffee but I'm fond of tea.
Originally published at Updated on ・2 min read

(Originally published on

Checklist: Publishing a package to PyPi

  1. Register an account on PyPi if you don't have one.
  2. Install setuptools and twine using pip if they aren't already. Create a in your source folder as follows (check out setuptools docs for more detailed setup options):

    # replace:
    # <your_package> with your actual package name.
    # <you> with your name.
    # <your_email> with your public email address.
    # <your_github_repo_url> with your github project's url.
    from setuptools import setup, find_packages
    s = setup(
        description="Foo App",
        python_requires = ">= 3.4",
  3. Optional: Bump up the version number (and git commit) if this isn't your first release:

    git add . && git commit -m "chore: released 1.0.1" && git push
  4. Run python sdist from your source folder to generate a source distribution.

  5. Optional: Sign the newly generated package with your gpg signature:

    gpg -a --detach-sign dist/<your-package>-1.0.0.tar.gz
  6. Upload your package using twine:

    twine upload dist/<your-package>-1.0.0.tar.gz -u <your-pypi-username> -p <your-pypi-password>

    If you've signed the package, then you may also add the signed .asc file as the argument like this:

    twine upload dist/<your-package>-1.0.0.tar.gz dist/<your-package>-1.0.0.tar.gz.asc -u <your-pypi-username> -p <your-pypi-password>
  7. Visit to verify that your package has been uploaded.

  8. Run pip install <your_package> to verify the package installation using pip package manager.

  9. Optional: Tag the commit with the new version number:

    git tag "1.0.1"
    git push --tags

Discussion (5)

themayurkumbhar profile image

Is it possible to do it on local without uploading to pypi?

prahladyeri profile image
Prahlad Yeri Author

Sure, just skip everything from point number 5. Instead, just install your locally generated package (*.tar.gz) using pip!

pip install <your-package>-1.0.0.tar.gz

You can even publish this package as a binary setup file on github or just email it to your friends to keep it local.

juancarlospaco profile image
Juan Carlos • Edited

No no, your should be empty, use CFG.

xowap profile image
Rémy 🤖

How would you test against the staging pypi repo before?

prahladyeri profile image
Prahlad Yeri Author • Edited

The twine project is considering to add a --dry-run mode or a staging server but I don't think that has materialized yet.

Forem Open with the Forem app