This assumes you already have the
- Sign up for PyPi account.
- Install Twine
python -m pip install twine
~/.pypircwith the content
Note that I did NOT save my password for security.
- In your Python package directory to upload
python setup.py sdist bdist_wheel twine upload dist/*
- Now the package is live to the world on PyPi. Anyone can install it via
python -m pip install myprogram
Minimal setup.py, setup.cfg
- assuming your package is named
myprogram, have a directory structure like
setup.cfg setup.py myprogram/ __init__.py
from setuptools import setup; setup()
NOTE: you must always have a
setuptools import when using
setup.py to build distribution, EVEN IF you don’t explicitly use it. Use
# noqa: F401 to quiet linters.
setup.cfg for PyPi enabling Markdown README.
Pick from the list of classifiers suitable for your project.
You MUST increment the
version number for each release, or PyPi will prevent upload
error: Upload failed (400): Binary wheel ‘*-cp36-cp36m-linux_x86_64.whl’ has an unsupported platform tag ‘linux_x86_64’.
This error happens because currently only
are accepted by PyPi.
It is not trivial to first start building
manylinux1 wheels, so consider workaround: don’t upload the wheel, just the source code and your users will compile it on their machine.
python setup.py sdist twine upload dist/*