Course Content

Creating a Python Package Using Setuptools | Python Tutorials For Absolute Beginners In Hindi #95

In this tutorial, we will learn how to create a Python Package Using Setuptools so that we can share or distribute it among others. I will walk you through all the steps so you may make your own package. 

Note: We are going to use visual studio in this tutorial. For more understanding about setting and using Visual Studio, you may refer my tutorial #121 and watch the video to learn the basics of the visual studio and its installation and use.

Python Package Using Setuptools:-

First, we are going to make a folder, and inside it, we are going to make a license and readme named text files ( we can also use the .md extension to create a markdown file instead of text, which is also a sort of text based file with better editing ). These license files contain the copyright details, and the readme will contain instructions that you want to convey. Along with the text files, we are also going to make a package folder. 

Now we will open our visual studio so we can make our work more simple and easier. By writing the command “code .” in our PowerShell, we can open our visual studio with the same directory address. Now we are going to create a file, and along with it, we will also create an file in our package folder.



The package code is present in, and is used for its identification. In simple words, tells setuptools about our package.

In, we will write all the functions we want our package to have. We can use classes too for this cause. In, we have to import the setuptools module, and we are going to use it setup function here.

from setuptools import setup

We will provide it with some basic details about our package, such as:

  • name: The name of the package. We can give our package any name of our choice.
  • version: The starting version should be 0.1 because with any update it automatically increases it to one decimal place 
  • description: Here, we give a brief description of our package and its functionalities and uses.
  • long_description: In the long description we give an explanatory description of our package
  • author: We can specify the creator of the package here
  • packages: Here we give the name by which we want our package to be called or imported
  • install_requires: If our package has a prerequisite package, then we have to specify that here so both of them can work simultaneously and can perform better.

Now we are going to build our package. We are going to open our terminal window or PowerShell in the same directory, and we are going to install the wheel.

pip install wheel

and after that, we are going to make our package using the command 

python bdist_wheel



python sdist bdist_wheel



Now our package is created, and we can install it using

pip install package_name



And we can also import it in the same way

Import package_name


Code as described/written in the video

from setuptools import setup
description="This is code with harry package",
long_description = "This is a very very long description",

Code as described/written in the video

class Achha:
    def __init__(self):
        print("Constructor ban gaya")

    def achhafunc(self, number):
        print("This is a function")
        return number

Be the first person to comment!



No downloadable resources for this video. If you think you need anything, please post it in the QnA!

Course Announcements

Any Course related announcements will be posted here