This repository contains a template and detailed instructions for publishing your Python package to PyPI. Follow the steps below to get your package live on PyPI.org.
-
Ensure your project contains the necessary files:
setup.py
README.md
- Any other required files (e.g.,
LICENSE
,.gitignore
)
-
Download the template and edit the files (Refer to the link given in resource section for the video explanation):
- Go to PyPI.org and create an account.
- Log in to your PyPI account.
- Go to your account settings.
- Navigate to the "API tokens" section.
- Click on "Add API token".
- Provide a name for your token and specify the desired scope (e.g., "Entire account").
- Click "Add token".
- Copy the generated token and keep it secure.
-
Make sure you have the latest versions of
setuptools
andwheel
installed:pip install --upgrade setuptools wheel
-
Build your package:
python setup.py sdist bdist_wheel
- Install Twine if you haven't already:
pip install twine
-
Use Twine to upload your package to PyPI:
twine upload dist/*
-
When prompted, enter your username (or
__token__
for token-based authentication) and your API token as the password.
- Check your package on PyPI.org to ensure it has been uploaded successfully.
setup.py
: Contains metadata and configuration for your package.README.md
: Your project's readme file (this file).- Additional files like
LICENSE
and.gitignore
as needed.
For more information and to download the template, visit the GitHub repository.
Happy publishing!