开发者

Building Sphinx Autodoc on a Google App Engine project

开发者 https://www.devze.com 2023-04-08 13:51 出处:网络
I have a Google App Engine project that I am trying to document with Sphinx. I am trying to use the autodoc feature for many of my modules/classes/functions.

I have a Google App Engine project that I am trying to document with Sphinx. I am trying to use the autodoc feature for many of my modules/classes/functions.

My Sphinx reST markup:

.. automodule:: urls
   :members: Urls

When I run make html, I get the error:

WARNING: autodoc can't import/find module 'urls', it reported error: "No module >named appengine.api", 开发者_C百科please check your spelling and sys.path

The file urls imports webapp2, which I believe will in turn try to import appengine.api. I don't think its possible to provide appengine.api to my sys.path. Is there some workaround?

PS. I'm not married to Sphinx. I would be open to epydoc or alternatives.


You can download the AppEngine SDK and then set your PYTHONPATH before calling make html.

For example, I downloaded the SDK and can do this:

$ ls /home/jterrace/Downloads/google_appengine/google/
appengine  __init__.py  net  pyglib  storage
$ PYTHONPATH="/home/jterrace/Downloads/google_appengine/google" python
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53) 
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import appengine
>>> import appengine.api
>>> 

So, you would do something like this:

PYTHONPATH="/home/jterrace/Downloads/google_appengine/google" make html
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号