Buku 3.8 or newer with readme.md
register to pypi and test.pypi
upgrade setuptools.
setuptools>=38.6.0is required to produce a distribution with the new metadatamake a source distribution. command:
python setup.py sdist. in this example it will producedist/buku-3.8.tar.gzinstall
twine>=1.11.0.upload first to test.pypi. command:
twine upload --repository-url https://test.pypi.org/legacy/ dist/buku-3.8.tar.gzif upload success but result is not as intended, change the version with
postn-suffix format. fix the program and go to number 5.if upload sucsess and result is as intended:
check the program version. maybe rolled it back to original if possible
upload it to pypi. command:
twine upload --repository-url https://upload.pypi.org/legacy/ dist/buku-3.8.tar.gz
this guideline is based on this guide https://dustingram.com/articles/2018/03/16/markdown-descriptions-on-pypi
Buku 3.7 or older with readme.rst
register to pypi and test.pypi
create ~/.pypirc and fill it with your config (example below)
remove readme.rst if exist
generate readme.rst
applied following fix:
check any text that maybe recognized as enumerated list
newline between example section
upload first to test.pypi. command: python3 setup.py sdist upload -r pypitest
if upload success but result is not as intended, change the version with
postn-suffix format. fix the program and go to number 6.if upload sucsess and result is as intended:
check the program version. maybe rolled it back to original if possible
upload it to pypi. command: python3 setup.py sdist upload -r pypi
code to generate readme.rst, require pypandoc from pip and pandoc e.g. from ubuntu repo (note that everytime setup.py executed it will generate readme.rst if not exist)
import pypandoc
long_description = pypandoc.convert_file('README.md', 'rst')
with open("README.rst", "w") as f:
f.write(long_description)
example pypirc
[distutils]
index-servers =
pypi
pypitest
[pypi]
repository=https://pypi.python.org/pypi
username=RachmadaniHaryono
password=<password>
[pypitest]
repository=https://test.pypi.org/legacy/
username=rachmadaniHaryono
password=<password>