1

I uploaded a python package to pypi. Following some online examples, I wrote a setup.py script and specified "text/markdown" as long_description_content_type, see the full script here

https://github.com/fangq/pyjdata/blob/master/setup.py

however, the description page on pypi does not display the subtitles and multi-line code properly, see

https://pypi.org/project/jdata/

can someone point me what to change to make this display correctly on PyPI?

phd
  • 82,685
  • 13
  • 120
  • 165
FangQ
  • 1,444
  • 10
  • 18

1 Answers1

2

You need to upload your package using twine version 1.11 or higher (and not directly using setup.py).

See https://dustingram.com/articles/2018/03/16/markdown-descriptions-on-pypi/

blami
  • 6,588
  • 2
  • 23
  • 31
  • thanks. I previously did use twine to upload, but I just checked my twine version, it was 1.5 (Ubuntu 16.04). I read [this link](https://packaging.python.org/tutorials/packaging-projects/), and used `python3 -m pip install --user --upgrade twine` to get twine 3.1.1, but `python3 -m twine upload --repository jdata dist/*` failed with ` __all__: List[str] = [] SyntaxError: invalid syntax` error. I do not want to upgrade my Ubuntu, is there a fix for this? – FangQ May 04 '20 at 15:18
  • 1
    @FangQ What's the output of `python3 --version` for you? Twine version 3.1.1 is for Python 3.6 and above only. – Dustin Ingram May 04 '20 at 17:17
  • `python3 --version` returns `Python 3.5.2`. `python3 -m twine --version` returns `twine version 3.1.1 (pkginfo: 1.5.0.1, requests: 2.23.0, setuptools: 46.1.3, requests-toolbelt: 0.9.1, tqdm: 4.46.0)`. So, does this mean even python3 3.5 installed twine 3.1.1, but it is insufficient to run it? – FangQ May 04 '20 at 18:40
  • problem solved. I installed python to 3.6, installed twine 3.1.1. After uploading package via the updated tools, the formatting on the [package website](https://pypi.org/project/jdata/) now looks normal. Thanks – FangQ May 08 '20 at 19:04