Skip to content
Home » Blogs » How to Create Your Own Python Module | Python

How to Create Your Own Python Module | Python2 min read

How to Create Your Own Python Module Python

We All Use Modules In Python For Our Projects Which Helps Us to Import & Start Working. So In This Post, I’ll Tell you How you can Create Your Own Module &  Publish It On PyPi Website. 

For this We Need a Module Called twine & a Python PyPi Account. 

Table Of Contents:

  • What is PyPI?
  • How to Create Account On PyPI
  • How To Create your Own Module 
  • How to Publish Your Created Module On PyPI

Read Also: 10 Python Projects For Beginners | Best Python Projects To Build In 2022!

What is PyPI?

Python Package Index Also Known as PypI, it is an Official Third-Party Repository Created For Python. We Use PyPI For Installing Python Modules it is a Hub of Various Python Modules With Several Features.

How to Create Account On PyPI

Step 1: Go to the Official Website of PyPI Which is at: https://pypi.org/

image

Step 2: Click On the Register Button, And You Will Be Redirected to the Register Page. Enter Your Name, Email Address, Username & Password And Click on  the Create Account Button.

How To Create your Own Module 

In Order To Create Your Module Follow the Steps Carefully:

Step 1: Create a  New File Called ‘setup.p’ Where You Have the Source Code of the Program, In My Case I am Creating the Module for Jarvis Project.

Read Also: Python Tutorial

Step 2: Install the Following Modules 

  • Install Twine Module
pip install twine
  • Install Wheel Module
pip install wheel

Step 3: Once You Install the Twine Module, Run the Following Code to Upgrade  the SetupTools

Upgrade SetupTools:

python -m pip install --upgrade twine setuptools

Step 4: Upload Your Library:

Type the Following Code To Upload  Your Library:

twine upload dist/*

Step 4: Congrats,You Have Published Your Own Module On PyPI. 

So this Was it for this Blog See you In the Next One Till Then Keep Coding Keep Exploring!

Tanmay Sinha

Leave a Reply