Sphinx autodoc 不夠自動化 - Sphinx autodoc is not automatic enough

問題:

I'm trying to use Sphinx to document a 5,000+ line project in Python.我正在嘗試使用 Sphinx 在 Python 中記錄一個 5,000 多行的項目。 It has about 7 base modules.它有大約 7 個基本模塊。 As far as I know, In order to use autodoc I need to write code like this for each file in my project:據我所知,爲了使用 autodoc,我需要爲項目中的每個文件編寫這樣的代碼:

.. automodule:: mods.set.tests
    :members:
    :show-inheritance:

This is way too tedious because I have many files.這太乏味了,因爲我有很多文件。 It would be much easier if I could just specify that I wanted the 'mods' package to be documented.如果我可以指定我想要記錄“mods”包,那會容易得多。 Sphinx could then recursively go through the package and make a page for each submodule. Sphinx 然後可以遞歸地遍歷包併爲每個子模塊創建一個頁面。

Is there a feature like this?有這樣的功能嗎? If not I could write a script to make all the .rst files, but that would take up a lot of time.如果沒有,我可以編寫一個腳本來製作所有 .rst 文件,但這會佔用很多時間。


解決方案:

參考一: https://en.stackoom.com/question/BKuc
參考二: https://stackoom.com/question/BKuc
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章