How to publish your python module in PiPY?

Aniket Pal
Nov 24, 2020 · 3 min read

Great! You are on the first line continue to read to reach the second line😂. To make this process really fun, I have gamified the steps for you and hopefully this will help you create amazing things.

Hey, this picture has nothing to do with PiPY. But the reason it is here is because the first package which I published generates their names. By the way, PiPY is a client library where you can find different python modules written by gorgeous people like you. Now, to install my package you may run:

python3 -m pip install superstar==0.1

It has nothing to do with your module generation. But if you have installed my module you might as well run it to get the name of your favorite superstar.

import superstar
superstar.get()

Hope you get the name of your superstar, if not, then run it a couple of times more and hopefully you’ll get it . Okay, enough of self publicity. Let’s get back to the game.

Yes, this was my favorite game I miss playing it so much😢. So the steps are in the form of game objectives and after completing each one, give yourself a pat on the back.

🔒So let’s collect ammunition.

Choose your playground I recommend VS Code. And then take some bullets i.e. some python packages

python3 -m pip install wheel
python3 -m pip install twine

Ah, it’s getting too much gamified let’s make it a bit technical.

🔒Register yourself in PiPy.

After you fill in the password don’t forget to mention that in the comment section , jk.

Treat your password like your toothbrush. Don’t let anyone else use it, and get a new one every six months.

🔒 Follow the file structure.

Make folder with the name of python module which you want to publish and another sub-folder with the same name. Then make a README.md file you can not change it after publishing your package so fill it wisely. You can refer to my cool readme.

just kidding readme can be made way better than this

You also need a license. For that you can choose any opensource license if you are okay with sharing your source code. Making your setup.py file is very important for your reference use can use it 👇

🔒 Time to run the following code and make your distribution file

python3 setup.py bdist_wheel

Don’t forget to test the functions you have written. If you are satisfied with the output, it’s time to help the world. So publish your creation in PiPY.

twine upload dist/*

After you enter your username and password it pushes your distribution files to PiPY. Open the link it gives you and check if everything is perfect. And you’re done! I hope this article helps you create wonders, so share your work on various platforms and show it off to your friends. If you liked the blog do share it with your friends as well. You can refer here if you get stuck somewhere in the code.

Thanks for reading!😄

Webwiznitr

Nothing is perfect but your website can be