[英]Should I include Sphinx and/or Nose in my module's requirements.txt?
I've created a Python module on Github that uses Nose for unit testing and Sphinx for generating documentation. 我在Github上创建了一个Python模块,它使用Nose进行单元测试,使用Sphinx生成文档。 I have two questions:
我有两个问题:
Should I include Sphinx and/or Nose in my module's dependencies in setup.py (install_requires), as they are not required for basic module functionality, only if you want to build the documentation/run tests yourself? 我应该在我的模块的setup.py(install_requires)依赖项中包含Sphinx和/或Nose,因为它们不是基本模块功能所必需的,只有你想自己构建文档/运行测试?
Should I include Sphinx and/or Nose in my module's requirements.txt on Github, for the same reasons but users that download my project from Github might be more likely to build docs/run tests? 我是否应该在Github上的模块的requirements.txt中包含Sphinx和/或Nose,原因相同但是从Github下载我的项目的用户可能更有可能构建docs / run测试?
This is my first Python module, so a bit of best practices/standards advice would be appreciated. 这是我的第一个Python模块,因此我们将非常感谢您提供一些最佳实践/标准建议。
If nose
and/or sphinx
are not required for the basic functionality of your package then don't include them in setup.py
. 如果包的基本功能不需要
nose
和/或sphinx
,则不要将它们包含在setup.py
。 There's no point in forcing users to install packages that they might not ever use. 强迫用户安装他们可能永远不会使用的软件包是没有意义的。 If they eventually want to help you develop your package they can install the requisite packages themselves.
如果他们最终想帮助您开发包,他们可以自己安装必需的包。
requirements.txt
files should also not include development-required packages, though there's some wiggle room there. requirements.txt
文件也不应该包含开发所需的包,尽管那里有一些摆动空间。
For example, over at pandas
we use requirements files for our Travis-CI builds. 例如,在
pandas
我们使用Travis-CI构建的需求文件。 You can check them out here . 你可以在这里查看 。
One thing we are considering is building our documentation on Travis-CI, as sometimes a failed doc build catches bugs that the test suite doesn't. 我们正在考虑的一件事是在Travis-CI上构建我们的文档,因为有时失败的doc构建会捕获测试套件没有的错误。 In that case we would put
sphinx
in the requirements file of the Python version we use to build the documentation. 在这种情况下,我们将
sphinx
放在我们用来构建文档的Python版本的requirements文件中。
Don't include those nice-to-haves in your setup.py. 不要在setup.py中包含那些有用的东西。 You can write a requirements file for developers if you like;
如果您愿意,可以为开发人员编写需求文件; users won't need one.
用户不需要一个。 For example, call one file
reqs.development
: 例如,调用一个文件
reqs.development
:
-e . # include the package defined by setup.py in editable (development) mode
nose
sphinx
Users can pip install yourmodule
or pip install https://your/tarball
, developers can fork, clone and pip install -r reqs.development
. 用户可以
pip install yourmodule
或pip install https://your/tarball
,开发人员可以fork,clone和pip install -r reqs.development
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.