How to publish your python module in PiPY?
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.
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!š