Are you ready to share your Python package with the world? Follow these steps to publish it on PyPI.org and let your code shine!
Create a Folder: Start by creating a folder on your Desktop (e.g., package).
Package Folder: Within the package folder, give life to your project by creating a new folder with the name of your package (e.g., saylani-ds).
Create Essential Files: Inside the saylani-ds folder, craft the following essential files:
license.txtreadme.txtsetup.pyThe Heart of Your Package: Create a file named __init__.py within the saylani-ds folder. This file is where the magic happens - write your entire library code here.
Setup.py Configuration: Open setup.py and pour in your package's vital information. Here's an example:
from setuptools import setup
setup (name="saylani-ds",
version="0.1",
description="This is a package",
long_description="A very, very long description of your amazing package.",
author = "Sir Qasim and Syed Muhammad Mooazam",
packages = ["saylani-ds"],
install_packages = []
)Install Dependencies: In the package folder, fire up your command prompt and execute these commands to set the stage for your package:
Install the "wheel" package:
pip install wheelCreate binary distribution packages:
python setup.py bdist_wheelBuild the source distribution package and binary distribution package:
python setup.py sdist bdist_wheelFolder Wonderland: After the previous steps, watch as two folders magically appear in the package folder.
Stay Updated: Whenever you make changes to your Python files, keep your packages updated by running this command:
python setup.py sdist bdist_wheelCreate a PyPI Account: If you don't already have one, embark on your journey at PyPI.org and set up your PyPI account.
Publish Your Package: It's showtime! Share your package with the world by following these steps:
Install the "twine" package:
pip install twineUpload your package to PyPI using "twine":
twine upload dist/*When prompted, enter your PyPI account username and password.
Now, your Python library is primed and polished for its grand debut. Share your creation with fellow developers and let the coding adventures begin!