setup.py - How can images be added to Python Package Index documentation? -
i have module repository features module code, readme.md file , images used in readme.md file stored @ directory images/
(linked in readme.md using relative links). in order register , upload module pypi, have files setup.py
, manifest.in
. how should things such such images included , appear in pypi online documentation (as appear in hypothetical page https://pypi.python.org/pypi/junkmodule)?
the manifest.in
, setup.py
have (and not include images in pypi online documentation) follows:
manifest.in
include license include readme.md include images/* include setup.py include junkmodule.py
setup.py
#!/usr/bin/python # -*- coding: utf-8 -*- import os import setuptools def main(): setuptools.setup( name = "junkmodule", version = "0.0.0.1", description = "provides nothing much", long_description = markdown_to_restructuredtext("readme.md"), url = "https://github.com/junkuser1/junkmodule", author = "l. ron. hubbard", author_email = "lrh@sern.ch", license = "gplv3", py_modules = ["junkmodule"], entry_points = """ [console_scripts] junkmodule = junkmodule:junkmodule """ ) def read(*paths): open(os.path.join(*paths), "r") filename: return filename.read() def markdown_to_restructuredtext(filename): try: import pypandoc return pypandoc.convert(filename, "rst") except: print("pypandoc not found; long description corrupted") return read(filename) if __name__ == "__main__": main()
Comments
Post a Comment