Skip to main content
 首页 » 编程设计

python之`python setup.py upload_docs` 成功但在线没有任何变化

2025年02月15日9lyhabc

我正在尝试使用 setuptools 在 pythonhosted.org 上发布文档,但是当 python setup.py upload_docs 成功时,在线没有任何更改,并且没有更新文档在我的包裹的 PyPI 日志中报告。

但是,我仍然可以使用 PyPI 网络界面手动上传 ZIP 文件,而且效果很好。

我曾经使用 MkDocs 构建和部署文档:

$ mkdocs build --clean 
$ python setup.py upload_docs 

他们都没有报告任何错误。新网站已正确生成,可由 MkDocs 在本地提供服务。

我尝试了 Python 3.4.2、3.5 和 3.6,以及几个版本的设置工具。我一定遗漏了一些明显的东西。

下面是 upload_docs 命令的输出(带有调试信息)。请注意,检测到网站内容存储在“./site”下。另见我的 project configuration ,尤其是 setup.py 和 setup.cfg。

$ python setup.py upload_docs 
options (after parsing config files): 
options (after parsing command line): 
option dict for 'aliases' command: 
{} 
option dict for 'metadata' command: 
{'description_file': ('setup.cfg', 'README.adoc')} 
option dict for 'upload_docs' command: 
{'upload_dir': ('setup.cfg', 'site')} 
running upload_docs 
Distribution.get_command_obj(): creating 'upload_docs' command object 
setting options for 'upload_docs' command: 
upload_dir = site (from setup.cfg) 
Upload_docs command is deprecated. Use RTD instead. 
Submitting documentation to https://pypi.python.org/pypi/ 
Server response (200): OK 

在此先感谢您的帮助。

请您参考如下方法:

None of them reports any error.

技术上是正确的,但您似乎忽略了一个简单的警告。从你的输出:

Upload_docs command is deprecated. Use RTD instead.

“弃用”部分 is clear enough : 不再推荐使用此命令。

“改用 RTD”部分不清楚,我承认。它应该更明确:它指的是 Read the Docs服务。

这是因为有一个 ( poorly documented as of 2017-04-05 ) 计划到 remove PyPI 文档托管服务。