First of all, install the dependencies needed to publish the package to PyPi:
pip install twine
pip install wheel
- twine: used to upload the project distribution to PyPi.
- wheel: used to build wheels for the project. A wheel is a built package that can be installed without needing to go through the "build" process.
Before building the new distribution version, update the following fields in setup.py
:
version
: should comply with semver.org.- Given a version number
MAJOR.MINOR.PATCH
, increment the:MAJOR
version when you make incompatible API changes,MINOR
version when you add functionality in a backwards-compatible manner, andPATCH
version when you make backwards-compatible bug fixes.
- Given a version number
classifiers >> Development Status
: seesetup.py
for more info.
Push your changes to Github.
After pushing the changes, go to the Github repository and create a new release using the same version
number you used in setup.py
:
- Go to the releases page.
- Click on the
Draft a new release
button.- Tag version: use the same
version
number you used insetup.py
. - Release title: use the same
version
number you used insetup.py
. - Description: write a markdown unordered list changelog using the following keywords:
add
,fix
, anddel
, in the same order; eg: - This is a pre-release: check this box if the release is a bleeding-edge one (not stable).
- Tag version: use the same
- `add` - new superpowah ! :)
- `add` - herobrine
- `fix` - error with blah, blah, blah
- `del` - crap
- `del` - old feature...
Source distributions are unbuilt, and require a build step when installed by pip.
python setup.py sdist
After building the project, a new folder should be created at dist/
, containing the packaged project.
To finish it all, run the command below to upload your distribution to PyPI:
python -m twine upload dist/*
You will need PyPI credentials in order to be able to upload the package.