Lets say you have a code-base that you feel would be helpful to the developer community
you can package it and upload to pypi so that other develeopers can install it using pip and use
this file shows exactly how to do this
ensure your python packages and modules are arranged in the folder structure as shown below
Note : your package should have a setup.py file, setup.cfg file, README.md file, and license.txt
as shown in the image above
Note : the name of your package name must be unique
Note : the folder containing your python modules should have a init.py file
note your setup.py and setup.cfg files should look like this
You will need to create create an account on test-pypi and pypi remember to keep your passwords safe You will need them moving forward
- open your teminal
- change directory to the root folder of your package (folder containing setup.py)
- run
python setup.py sdist
- run
pip install twine
- run
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
- this will prompt you for your testpypi username and password
- after your file has been successfully uploaded you can login to the test-pypi site to confirm that your package was uploaded successfully
- run
pip install --index-url https://test.pypi.org/simple/ your_package_name
to install the test package
while still in your package root dir
- run
twine upload dist/*
- this will prompt you for your pypi username and password
- after your file has been successfully uploaded you can login to the pypi site to confirm that your package was uploaded successfully
- run
pip install your-package-name
to install the test package
Contratulations 🍾 🎆 🍾 your package is live and anybody can use it by running pip install your-package-name
on their machine
I will be happy to accept any contributions you might have to this guide do well to open an issue or even a PR
Made with ❤️ by JeremAIh