2016-08-28 62 views
1

我使用sphinx-autodoc-annotation來讀取我的Python代碼中的函數註釋,並使用它來生成適當的預期參數類型和返回類型。它在我的本地機器上運行良好,但我當然需要pip install sphinx-autodoc-annotation如何配置讀取文檔以使用sphinx-autodoc註釋?

我試圖使用生成的Read the Docs同一文檔,但它給了我一個錯誤:

Could not import extension sphinx_autodoc_annotation (exception: No module named sphinx_autodoc_annotation) 

是否有可能配置閱讀文檔與獅身人面像,車博士的註釋工作,如果是這樣,我如何使它工作?

回答

1

激活安裝項目選項用於讀取文檔項目。

如果激活該選項,則讀取文檔將嘗試在您的包裝上執行setup.py install(請參閱:RtD docs)。在setup.py中,您可以按照您的requirements file中的指定安裝軟件包。 查看source code of the Flask-MongoRest project的例子。

sphinx-autodoc-annotation添加爲您的requirements.txt文件的唯一要求。

+0

這很接近,但還沒有完全正常工作。我在'docs'文件夾中添加了'requirements.txt'(因爲它只需要構建文檔,而不是項目本身),指出在RtD設置中,打開了「使用setup.py在virtualenv中安裝項目安裝」。我沒有收到錯誤,但是現在無法創建在本地運行Sphinx時創建的'py-modindex.html'文件。我認爲我需要提供所有這些額外的細節問題。 – Chuck

相關問題