2017-01-13 1 views
0

Ich möchte eine README.md Datei mit meinem Modul-Paket für PyPI, so dass es von einer Funktion in meinem setup.py gelesen werden kann. Allerdings ist es für mich nicht offensichtlich, wie man setup.py und zugehörige Infrastruktur erhält, um die README.md Datei tatsächlich einzuschließen.Wie kann eine README.md-Datei in ein PyPI-Modulpaket mit setup.py eingebunden werden?

Ich habe eine MANIFEST.in Datei in meinem Paket enthalten, das sich README.md und ich habe das setuptools.setup Argument include_package_data zu True aber das hat nicht funktioniert gesetzt auflistet.

manifest.in:

junkmodule.py 
junkmodule_script.py 
LICENSE 
MANIFEST.in 
README.md 
setup.py 

setup.py:

#!/usr/bin/python 
# -*- coding: utf-8 -*- 

import os 
import pypandoc 
import setuptools 

def main(): 

    setuptools.setup(
     name     = "junkmodule", 
     version    = "2017.01.13.1416", 
     description   = "junk testing module", 
     long_description  = pypandoc.convert("README.md", "rst"), 
     url     = "https://github.com/user/junkmodule", 
     author    = "LRH", 
     author_email   = "[email protected]", 
     license    = "GPLv3", 
     include_package_data = True, 
     py_modules   = [ 
           "junkmodule" 
           ], 
     install_requires  = [ 
           "numpy" 
           ], 
     scripts    = [ 
           "junkmodule_script.py" 
           ], 
     entry_points   = """ 
      [console_scripts] 
      junkmodule = junkmodule:junkmodule 
     """ 
    ) 

if __name__ == "__main__": 
    main() 

Die Befehle Ich verwende das Modul PyPI zu registrieren und laden Sie sind wie folgt:

python setup.py register -r https://pypi.python.org/pypi 
python setup.py sdist upload -r https://pypi.python.org/pypi 

Antwort

0

ich dies mit Versuchen Sie in meinen Modulen:

import pypandoc 


try: 
    description=pypandoc.convert('README.md', 'rst') 
except (IOError, ImportError): 
    description=open('README.md').read() 
Verwandte Themen