Search code examples
pythonpippypi

Publishing modules to pip and PyPi


I have created a module using python. I want to publish it to pip and PyPi so that others can download and use it easily. How do I do it?


Solution

  • The answer can be easily found on the Internet. I just referenced this site to answer you. You can follow the steps below:

    1. create an account on PyPi.

    2. Create a README.md file as an instruction for users (Highly recommended).

    3. Create a setup.cfg file, and write the following content:

    [metadata]
    description-file = README.md
    
    1. Create a LICENSE file by referencing this website.

    2. As @Yang HG mentioned, write a setup.py file, followed by running python setup.py sdist.

    3. Upload your distribution by using twine. First, you need to pip install twine, then run twine upload dist/*.

    Finally, your distribution can be viewed on https://pypi.org/project/YOURPACKAGENAME/