Skip to content
Related Articles

Related Articles

How to Publish Python package at PyPi using Twine module?

View Discussion
Improve Article
Save Article
  • Last Updated : 19 Oct, 2021
View Discussion
Improve Article
Save Article

Python is so flexible and easy to use because of its available packages that are hosted on, Let’s see how to publish your own package on PyPi using Twine module.


  • You must have account of, if don’t create an account
  • The twine library is created to simplify uploading packages in pypi. To install twine library.
pip install twine
  • Get your package ready.

Steps to publish package:

Step 1: Prepare and organize the package

  • Create a folder name must be same as package name. (Ensure that the name of your package does not pre-exist in PyPi)
  • Inside this create another folder with same name or same package name, inside that put all the .py files with a single compulsorily file and all folders/programs must be imported in .
  • Now outside of programs folder and inside the root folder, file, file and License.txt file must be created. Below is the flow diagram of the hierarchy:

For the sub-folder akshaypawar-tut:

Step 2: Creating file

The .md files are mark down files just as markup languages, it has it’s own syntax,it is used as a User-Friendly Readme file which will be displayed on home page.

You may use extensions for VS Code or any online editors like to create .

Step3: Creating License.txt file

Your package must have license, If you don’t have any concern to sharing it all over world you may use License.txt. If your package has policies you may use any online license maker website like .

Step 4: Create File

Your package must have a file as it’s one of binding component of package, It describes dependencies of the package and author version, etc.

Below is the code for general . One needs to use their own credentials. 


import setuptools
with open("", "r") as fh:
    long_description =
    # Here is the module name.
    # version of the module
    # Name of Author
    author="Akshay Pawar",
    # your Email address
    # #Small Description about module
    # description="adding number",
    # long_description=long_description,
    # Specifying that we are using markdown file for description
    # Any link to reach this module, ***if*** you have any webpage or github profile
    # if module has dependencies i.e. if your package rely on other package at
    # then you must add there, in order to download every requirement of package
    #     install_requires=[
    #      "package1",
    #    "package2",
    #    ],
    # classifiers like program is suitable for python3, just leave as it is.
        "Programming Language :: Python :: 3",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",

Step 5: Final Stage

Here you have to create account on also we will be using twine library. The whole package is uploaded in the form of .dist file.

To create .dist file use command:

# Windows
python bdist_wheel 


# Linux/Mac
python3 bdist_wheel 

You will observe this message on Powershell when the above commands are executed.

Now our binary .dist file is created, now we need to upload it using the below command:

twine upload dist/* 

Enter the required credentials regarding account and the package will be uploaded.

After successful upload you will get a link of your project and all the details 

 Click here to see the uploaded package discussed in the article. 

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!