I updated my package autolike today using the following steps:
- Changed the version number in
setup.py
and modify package as necessary.
Assuming you’re in the root of your project directory, then run:
pip install -e .
pip install --upgrade build
python -m build
Generate API token from https://pypi.org/manage/account/ for your package.
pip install --upgrade twine
python -m twine upload dist/*
Here you need to use the following credentials
username: __token__
password: <YOUR API TOKEN>
You can see if your package has successfully uploaded by navigating
to the URL https://pypi.org/project/ where sampleproject
is the name of your project that you uploaded.
It may take a minute or two for your project to appear on the site.
Minimally, you should create a Source Distribution:
python3 setup.py sdist
You should also create a wheel for your project. A wheel is a built package that can be installed without needing to go through the “build” process. Installing wheels is substantially faster for the end user than installing from a source distribution. Universal Wheels are wheels that are pure Python (i.e. contain no compiled extensions) and support Python 2 and 3. This is a wheel that can be installed anywhere by pip.
python3 setup.py bdist_wheel --universal
Only use the --universal
setting, if:
- Your project runs on Python 2 and 3 with no changes (i.e. it does not require
2to3
). - Your project does not have any
C
extensions.
thanks a lot. it's clear and concise helped me a lot. 👍