sphinx-autogen usage

1,925 views
Skip to first unread message

brian

unread,
May 15, 2011, 6:46:32 PM5/15/11
to sphinx-dev
I'm new to Sphinx and I'm having trouble getting started with sphinx-
autogen.

All the doc I've found said I can run sphinx-autogen without command
line arguments. When I run the command line I get
--------------------------------------------
"C:\Program Files\Python26\python" sphinx-autogen.py
Usage: sphinx-autogen.py [OPTIONS] SOURCEFILE ...

sphinx-autogen.py: error: no input files given
--------------------------------------------

I'm not sure what it is expecting in SOURCEFILE so I put my top python
file and get:
--------------------------------------------
[autosummary] generating autosummary for: c:\Users\brian downing
\Documents\PyDev
\src\yCreateDcOptObj.py
--------------------------------------------
but I don't get the conf.py file or a directory.

How do I get started with the tool? I'm using Sphinx 1.0.7, python
2.6.5, and windows vista

Brian

Ernesto Posse

unread,
May 16, 2011, 3:08:32 PM5/16/11
to sphin...@googlegroups.com, brian....@yakkadesign.com
Basically you pass sphinx-autogen the .rst files, not the Python code.
sphinx-autogen doesn't generate the conf.py file either. It's
sphinx-quickstart who generates it.

Sphinx finds the Python code by using the sys.path variable which you
can set in the conf.py file (it is found near the beginning of the
file). For example you can write in conf.py:

sys.path.insert(0, os.path.abspath('../../src/'))

where '../../src' is an example of a path to your Python sources.

Since you are starting, maybe you don't even need autogen at all. I
recommend you to read the tutorial:
http://sphinx.pocoo.org/tutorial.html

Typically it is enough to use sphinx-build as described here:

http://sphinx.pocoo.org/tutorial.html#running-the-build

Note that you do not even need to call sphinx-build directly but go to
the source folder (the one with the conf.py and .rst files) and type

make html

or

make latex

etc.

In summary you probably want to do:

1) run sphinx-quickstart
2) edit the index.rst file, adding the contents
3) edit the conf.py file, adding the path to you Python packages to sys.path
4) run sphinx-autogen -o generated *.rst
5) edit generated/*.rst files as is suits you
6) run make html

> --
> You received this message because you are subscribed to the Google Groups "sphinx-dev" group.
> To post to this group, send email to sphin...@googlegroups.com.
> To unsubscribe from this group, send email to sphinx-dev+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/sphinx-dev?hl=en.
>
>

--
Ernesto Posse

Modelling and Analysis in Software Engineering
School of Computing
Queen's University - Kingston, Ontario, Canada

Reply all
Reply to author
Forward
0 new messages