Publish Package to PyPI

Abhishek Amralkar
2 min readJul 7, 2020


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)?