سؤال

I'm following setuptools tutorial and, after solving several problems, I came up with the final readme file problem - I created a README.rst file in the project (hosted on github) and I use it in the setup.py file, just like the tutorial says:

import os
from setuptools import setup

def read(fname):
    return open(os.path.join(os.path.dirname(os.path.abspath(__file__)), fname)).read()

setup(
    ...
    long_description = read('README.rst'),
    ...
)

I have managed to successfully upload my registered python package and I try to install it locally using pip - and that's where the problem occurs:

$ sudo pip install nac
Downloading/unpacking nac
  Downloading nac-0.1.0.tar.gz
  Running setup.py egg_info for package nac
    Traceback (most recent call last):
      File "<string>", line 14, in <module>
      File "/home/tomasz/build/nac/setup.py", line 22, in <module>
        long_description = read('README.rst'),
      File "/home/tomasz/build/nac/setup.py", line 5, in read
        return open(os.path.join(os.path.dirname(os.path.abspath(__file__)), fname)).read()
    IOError: [Errno 2] No such file or directory: '/home/tomasz/build/nac/README.rst'
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 14, in <module>

  File "/home/tomasz/build/nac/setup.py", line 22, in <module>

    long_description = read('README.rst'),

  File "/home/tomasz/build/nac/setup.py", line 5, in read

    return open(os.path.join(os.path.dirname(os.path.abspath(__file__)), fname)).read()

IOError: [Errno 2] No such file or directory: '/home/tomasz/build/nac/README.rst'

I know what is the reason for this error: the installer has downloaded the package and it tries to run setup.py, but it cannot find the .rst file and it finally stops.

I want to have a top-level documentation for github (it is displayed automatically on repo homepage) and the top-level docs files don't belong to any python modules (are not included in pip packages). Anyway, I can't come up with a smart solution to overcome this. And that's the conflict... Any ideas are welcome.

هل كانت مفيدة؟

المحلول

I have found appropriate information in Python Package Distrubition tutorial According to it, I just needed to add MANIFEST.in file with following content:

include *.rst

and that's all.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top