Save for Later
Build
Your Own
Python
PIP Package
1. Create a directory for your package and navigate into it.
2. Create a new file named setup.py and include the
following code:
Replace the placeholders with your package name, version,
description, author name and email, URL, and package
name.
3. Create a directory with the same name as your package,
and add your package code inside it.
4. Create a file named __init__.py inside your package
directory. This file will be executed when your package is
imported.
5. Create a README.md file with the package's
documentation and instructions for installation
and usage.
6. Optionally, create a LICENSE file with the license
information for your package.
7. Navigate to the directory containing setup.py in your
terminal and run the following command to build the
package:
This command will create a source distribution and a
binary distribution of your package.
8. Upload your package to PyPI using twine. If you don't
have twine installed, you can install it using pip:
9. Then, run the following command to upload your
package:
This command will upload all the distributions of your
package to PyPI.
Your package is now published on PyPI and can be
installed using pip install <package-name>.
Hope it helps!
Save for Later
Looking to master Python, SQL, Machine
Learning, Deep Learning, and Statistics?
Send me a message to customize your
learning journey
@arjun-panwar