-
Notifications
You must be signed in to change notification settings - Fork 8
Upload to pypi
The first thing to do before building and uploading to pypi, you will need to change package version. To do so you will need to open the setupPypi.py in the root directory. Once open search the following line and change it's version:
package_version = "3.17.0"
You will need 2 libraries to build and install your package:
- build
- twine
To install them run the following commands:
python3 -m pip install --upgrade build
python3 -m pip install --upgrade twine
Now that everything is installed, you are able to build your package. To do so run the followings:
# to build tar ball of the current release
#
# first make a proper tag, e.g. git tag 4.0.2
# then run the following command to create release tar-ball file
# it will be created under dist/dbs3-client-4.0.2.tar.gz
python3 setup.py sdist
# to install wheel package first ensure that you have wheel installed on your system
pip3 install wheel
# now you can run setup with bdist_wheel (without wheel package it will fail):
python3 setup.py bdist_wheel
This will create a new dist directory (if it does not exists) and put your build in it. The first command will create a tar.gz file with the source file in it and the second command will create the wheel file.
Finally, you can upload your build to pypi with the next command:
# first, install twine package on your system
pip3 install twine
# now you can upload your release to PyPi
python3 -m twine upload --repository pypi dist/*
# alternatively, you may run twine command directly as following:
twine upload --skip-existing --username <YOUR_LOGIN> --verbose dist/*
# if load to test pypi
twine upload --skip-existing --repository-url https://test.pypi.org/legacy/
dist/*
It will then ask your pypi username and password. Congratulation your package is now on pypi.
*Note : More details to upload package to pypi here.