Skip to content
Sign upLog in
← Back to Community

How to Make a Module for Pip

Profile icon

How to make a Module for Pip.

Step 1

Make a new bash repl.

Step 2

Now it's time for the files. Create a folder named myapp. inside of myapp create a folder named your module. Inside of Your module folder create a file named Now create another file inside of your module named (or any other name.). Your file system should look like this:

MyApp -MyModule --\__init\

Now inside of the MyApp folder make a file named Now make a file and a LICENSE. The File System should now look like this:

MyApp -MyModule --\__init\ -LICENSE

Step 3

Now it's time for the code! go to and make the functions for your module. use the def function for this. Here is an example:

def hWorld(): """ Prints 'Hello World!' to the terminal. """ print("Hello World!")

The """ is a multi-line comment that gives a description for people that are using the help() command. Now once you are done go to and type in the following code:

from .main import *

and that's all you need for the file. Now let's go to the file.

Step 4

For the file type in the following template and replace with your info:

from setuptools import setup with open("", "r") as fh: long_description = setup( name = "Main", version = "1.0.0", description = "Example Module.", long_description = long_description, long_description_content_type = "text/markdown", url = "#Github or Website. This parameter isn't needed.", author = "Your name", author_email = "Your email", #To find more licenses or classifiers go to: license = "GNU General Public License v3 (GPLv3)", packages=['MyModule'], classifiers = [ "Programming Language :: Python :: 3", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Operating System :: OS Independent", ], zip_safe=True, python_requires = ">=3.0", )

That's it now after done replacing with your info (make sure you have everything!) it's time to actually find a licence...

Step 5

A website to find the right open-source license for you can be found here:
After finding the right license copy and paste it into your LICENSE file. After your done with that make up your file. Make sure this is what people will want to see before installing your module because this is what people will see on the module page. Make sure to also list some commands with basic syntax for your module.

Step 6

This is all fine and dandy, but how do we upload to pypi? I don't see any upload project button... Well, it's a little more complicated than that, but fun!
press ctrl + shift + s. This will bring up a terminal. type into the terminal:

cd MyApp pip3 install --upgrade setuptools wheel python3 sdist bdist_wheel pip3 install twine python3 -m twine upload --repository pypi dist/*

This will ask for your username and password for pypi, enter these and it should then be uploaded to pypi!

All Done!

Now you can view your module on your pypi account and you will be able to install it using pip. I hope you guys found this helpful! Make sure to check out my clearing module that clears the terminal for multiple platforms here I'll see you all in the next one!

(If you have any suggestions or comments on this post I will do my best to update the post to be even more helpful. see ya guys!)

More links to external sites for more help and info:

(please note that repl won't automatically import these modules for unknown reasons... in order to install the module use pip.)

#A simple script to see if the user has the module installed and if not then install the module. import os try: import *modulename* except: os.system("pip3 install *modulename*") import *modulename*
Profile icon
Profile icon
Profile icon
Profile icon
Profile icon
Profile icon
Profile icon
Profile icon

So, I did all of the things that you explained, but doesn't show it in the 'packages' area. Is this a problem?

Profile icon

This is a problem on's end... However you can still install using pip. Just press ctrl + shift + s then pip install (your package name) and it should install.

Profile icon

Yeah, I tried that. I fixed it anyway. It turns out I didn't add the zip-safe parameter somehow. Also, note, this actually threw me off, but under Step 6 for the commands you need to type in, you misspelled Python3 as Pythons.

Profile icon


I worked great, but how do you update your project?

Profile icon

how do you update a module

Profile icon

Unfortunately, there isn't a way to "overwrite" a description or a version, however you can make a new version of the code by:

  1. Update the description, or whatever you need to update such as code.
  2. update the version to 0.0.2 or 1.0.1
  3. You have to update the readme file or twine won't let you upload. If you don't want to change anything just put down in the bottom as a footer or something "version - 1.0.1"
  4. Re-make the module into wheels and a tar.gz.
  5. Upload using twine.
  6. Yank the earlier version to make it deprecated. (You may have to do this before uploading, I'm not sure.)
  7. Done. I hope this helps!
Profile icon

I have made another module named: simpleton. Simpleton is a module that auto-imports commonly used standard libraries like math, re, os, random, etc. You can view the module here:

Profile icon

If you need more help this link might help: