Sphinx automodule 运行我的代码

Sphinx automodule runs my code

如果我包含以下文件

The xxx API reference
===============================

.. automodule:: sphinx_test
   :members:

在我的 Sphinx 文档中,每次我 'make html'

它都会运行模块 sphinx_test.py

这正常吗?是否有某个标志可以关闭我所缺少的这种行为?

在这种情况下,这是因为我是 运行 一个 wxPython 应用程序和我的

screen_app = wx.App()
main_frame = MainFrame()
screen_app.MainLoop()

代码不受

保护
if __name__ == "__main__":

感谢 Paebbels 的提示