How to publish your python module in PiPY?

Aniket Pal
Webwiznitr
Published in
3 min readNov 24, 2020

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!šŸ˜„

--

--

Aniket Pal
Webwiznitr
Editor for

Sophomore EE NITRKLā€™23 | Novice developer šŸ˜