如何在 python 发行版中包含 docs 目录 [英] How to include docs directory in python distribution

查看:35
本文介绍了如何在 python 发行版中包含 docs 目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有以下结构的 python 项目:

I have a python project with the following structure:

Clustering  (project name)
  clustering  (package)
    clustering.py and other modules
    tests  (sub-package)
      test_clustering.py and other such files
  docs/
  bin/

我想在我的发行版中包含 docs 目录,但我似乎无法做到这一点.关于如何做到这一点的任何指示都会非常有帮助.

I would like to include the docs directory in my distribution, but I can not seem to do that. Any pointers about how this can be done would be very helpful.

我当前的 setup.py 看起来像这样:

My current setup.py looks like this:

from distutils.core import setup
setup(name='Clustering',
      version='1.0',
      description='desc',
      author='A',
      author_email='me@somemail.com',
      packages=['clustering', 'clustering.tests'],
      requires=['numpy', 'scipy'],
      scripts=['bin/predict', 'bin/verify']
     )

我尝试使用 package_data 选项,但没有成功将 docs 目录包含在发行版中.是否有其他一些传统方式可以将您的文档包含在发行版中?

I tried using the package_data option but haven't been successful in including the docs directory in the distribution. Is there some other conventional way of including your docs in the distribution?

推荐答案

您需要创建一个 MANIFEST.in 文件并包含一些关于要包含哪些额外文件的简单说明(请参阅 MANIFEST.in 模板)

You'll need to create a MANIFEST.in file and include some simple instructions on what extra files you want to include (See MANIFEST.in Template)

示例(包括文档目录和直接位于下面的所有文件):

Example (to include docs dir and all files directly underneath):

include docs/*

或者,将所有文件包含在 doc 目录中(递归):

or, to include all files in the doc dir (recursively):

recursive-include docs *

这篇关于如何在 python 发行版中包含 docs 目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆