Publish Package to PyPI

In this blog we will walk through how to publish packages to


The very first requirement is to have an account on PyPI.

We need to install 3 tools globally

  1. wheel
  2. setuptools
  3. twine
pip3 install setuptools wheel twine

Getting Started

We will be publishing the `covin-cli` project to PyPI.

  • As a best practice create a high level directory with the same name as our package name in our case covin-cli.
  • Now create a file in covin-cli directory so that Python will see our code as a package.
❯ cd covin-cli
❯ tree
└── covin-cli
1 directory, 1 file
  • Now you can add your code in a Python file.
  • We need to add 3 files to publish the package to PyPI to the root directory in-order to publish a package to PyPI., LICENSE, README or

A well written README describing about your code.


You can go to and choose license which you want to have.

Generate Packages

Now we need to generate 2 packages sdist(Source Distribution) and bdist_wheel (Build Distribution)

python3 setup sdist bdist_wheel

Above command will generate 2 directories build and dist in the dist directory we will have wheel file which is build distribution and a source distribution.

❯ tree
├── dist
│ ├── covin_cli-1.0-py3-none-any.whl
│ └── covin-cli-1.0.tar.gz
0 directories, 2 files

Now the final step is to upload to PyPI. We will use twine to upload our packages

❯ twine upload dist/* --verbose
Uploading distributions to
dist/covin_cli-1.0-py3-none-any.whl (16.5 KB)
dist/covin-cli-1.0.tar.gz (4.5 KB)
Enter your username: abhishekamralkar
Enter your password:
Uploading covin_cli-1.0-py3-none-any.whl
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 25.0k/25.0k [00:08<00:00, 3.02kB/s]
Uploading covin-cli-1.0.tar.gz

Once the package uploaded it will be available at

To install

❯ pip3 install covin-cli==1.0
Defaulting to user installation because normal site-packages is not writeable
Collecting covin-cli==1.0
Using cached covin_cli-1.0-py3-none-any.whl (16 kB)
Installing collected packages: covin-cli
Successfully installed covin-cli-1.0

To Uninstall

❯ pip3 uninstall covin-cli==1.0
Found existing installation: covin-cli 1.0
Uninstalling covin-cli-1.0:
Would remove:
Proceed (y/n)?

DevSecOps Practitioner | DevOps Enthusiast | Clojure | Cloud Automation | Cloud Security Enthusiast

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Implementing Reactive Messaging with Red Hat AMQ and Red Hat Quarkus

Connect Client to Django Channel service through Kong Gateway by Websocket

Structuring and managing CSS

How to Speed Up Magento: A Guide by Top-rated Magento Development Company

[Leetcode] Combination Sum IV

Computer Shop Barkingside

Barkingside Computer Shop

The office digital maturity check-list

How Simpler and Shorter Code of Kotlin Has Changed the Android Development Experience?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Abhishek Amralkar

Abhishek Amralkar

DevSecOps Practitioner | DevOps Enthusiast | Clojure | Cloud Automation | Cloud Security Enthusiast

More from Medium



Convert a SQL Server Backup (.BAK) File into CSV for a Specified Table in Python

How To Execute SQL Server Stored Procedure From Python?