Frequently Asked Questions

Contents

Docstrings & Docstring Markup

Extracting Documentation

Generated Output

Development of Epydoc

Ask a new question...

Docstrings & Docstring Markup

Q: Why does epydoc get confused when I include a backslash in a docstring?

A Python docstring is a string, and is interpreted like any other string. In particular, Python interprets "\n" as a newline, "\t" as a tab, etc. If you want to include backslashes in your docstring (e.g. because you want to talk about file paths, regular expressions, or escaped characters), you should use a raw string. E.g.:

>>> f(x):
...     r"""
...     Return true if x matches the regexp '\w+\s*\w+'.
...     """
    

Q: Which markup language do you recommend?

For many modules, epytext works well: it is very lightweight, so it won't get in the way; but it lets you mark important information about objects. If you would like to use a more expressive markup language, then I recommend using reStructuredText, which is easy to write, easy to read, and has support for a very wide array of constructs.

Q: reStructuredText is capitalized weirdly; Javadoc has too much caffeine; and Epydoc just isn't cool enough. Will you add support for my favorite markup language xyz?

No, but you can! See the documentation for the function register_markup_language(), which can be used to register new markup languages. If you add support for a new markup language, and believe that others might like to use it, please contribute it back to epydoc!

Q: Is there a way to define a new field?

You can add new fields that describe simple metadata using the @newfield field. See the documentation for fields for more information.

Extracting Documentation

Q: Why does epydoc use both introspection and parsing? Wouldn't one or the other be sufficient?

Epydoc can extract documentation about objects from two different sources: inspection (importing the objects and examining them programmatically) and parsing(reading and extracting information from the objects' Python source code). Furthermore, epydoc can combine documentation information obtained from these two sources. This is important because each source has its own advantages and disadvantages with respect to the other. In particular:

  • Introspection gives epydoc an accurate picture of what modules will look like programmatically. In particular, some modules actively modify the namespace they define, or use various "magic" techniques to alter their public interface. Using introspection gives epydoc an accurate picture of what these modified interfaces look like.
  • If a module has dependencies that are not met on the current system, then it may not be possible to import and introspect it; but the parser can still examine its contents.
  • If importing a module has significant side effects, then introspecting it might not be desirable; but the parser can still examine its contents.
  • If a module is not trusted, then it might not be desirable to import it; but the parser can still examine its contents.
  • By parsing a module, we can find "pseudo-docstrings" and "docstring comments," which are unavailable via introspection. In particular, this makes it possible to associate API documentation with variables.
  • Introspection can give information about builtin and extension modules, which would be unavailable to a python source code parser. This includes builtin or extension bases for pure Python classes.
  • By parsing a module, we can easily determine which values were imported, and where they were imported from. This information is not available via introspection.

Q: When should I use --parse-only?

The --parse-only option instructs epydoc to only get documentation information from parsing (and not from introspection.) You should use this option if:

  • The project you are documenting contains untrusted source code.
  • The project you are documenting has dependencies which are not met (e.g., documenting windows-specific code on a non-windows machine).
  • You wish to document a module where importing the module would have undesired side effects.

Generated Output

Q: How can I change the appearance of the HTML output?

The CSS stylesheet can be used to modify the colors, fonts, and styles that are used by epydoc. You can specify your own CSS stylesheet using the --css option. (To generate the default stylesheet, simply run epydoc on a small module.)

If your objections have to do with the actual layout of the pages, then I'd be happy to hear your suggestions for improving it; but I'm fairly happy with the layout, and probably won't make changes unless I agree that they improve the appearance significantly.

Q: How can I change the appearance of the LaTeX, Postscript, or PDF output?

Currently, the LaTeX output, and derived output formats, are not very customizable. If you have suggestions for improving the appearance of the generated output, please let me know.

Q: How can I include graphs in the generated output?

Epydoc can automatically generate a variety of graphs, including class tress, package trees, uml class graphs, and import graphs. These graphs can be included in one of two ways:

Graph generation requires the Graphviz package. If the dot executable is not on the path, then its location should be specified using the --dotptah option.

Q: How can I exclude a specific object from the generated documentation?

Use the @undocumented field. See the documentation for fields for more information.

Development of Epydoc

Q: I've found a bug in epydoc! Where should I report it?

Use the Sourceforge bug tracker to report bugs. If you want to hear back when I fix it, be sure to either log in to Sourceforge, or include your email address in the bug report.

Q: I'd like to help! What can I do?

If there are any features that you want to add to Epydoc, I'd be happy to accept patches. Patches should be submitted with the Sourceforge patch tracker (be sure to describe what your patch does!). If you plan to make several changes, I could also add you as a developer on Sourceforge. Email me if you're interested.

For a list of additions that I'd like to make to Epydoc, see the todo list in the Epydoc reference documentation; or the SourceForge feature request tracker and bug tracker

Q: I'm documenting a large project. How can I make epydoc go faster?

Try the following options:

−−no-sourcecode Don't generate pages containing source code with syntax highlighting.
−−no−private Don't generate documentation for private objects.
−−introspect−only or −−parse−only Extract information about objects using introspection or parsing (but not both). This may decrease the amount of information that epydoc can extract from your project.
−−docformat=plaintext Format docstrings as plaintext, instead of epytext. (Docstrings will be rendered verbatim).

Also, note that including graphs in the output can slow epydoc down significantly.