Skip to content

Docs/automodapi extension - #115

Merged
eteq merged 32 commits into
astropy:masterfrom
eteq:docs/automodapi-extension
Mar 15, 2012
Merged

eteq merged 32 commits into
astropy:masterfrom
eteq:docs/automodapi-extension

Conversation

@eteq

@eteq eteq commented Dec 27, 2011

Copy link
Copy Markdown
Member

This adds a new sphinx extension that automatically creates "autosummary" style tables based on the public attributes in a package/module. It also adds a "automodapi" sphinx directive that can be used to quickly generate a canonical api style that we would presumably adopt for most astropy packages.

To see the extension in action, build the docs from this branch, and look at the "Reference/API" section of the "Configuration system Documentation" section of the documentation.

If this goes through, I'll use it to refactor and clean up the documentation to have uniform API sections (except for vo and pywcs, given that they're already in-place and would probably be complicated to adjust).

@astrofrog

Copy link
Copy Markdown
Member

I get a couple of errors:

/Users/tom/dropbox/code/development/astropy_forks/eteq/docs/development/testguide.rst:43: ERROR: Error in "note" directive:
invalid option block.

.. note::
    This method of running the tests defaults to the version of `py.test` that
    is bundled with Astropy. To use the locally-installed version, you should
    either change the `use_system_pytest` configuration option to "True" (see
    :doc:`../../configs`) or the `py.test` method describe below.
/Users/tom/dropbox/code/development/astropy_forks/eteq/docs/development/testguide.rst:138: ERROR: Error in "note" directive:
invalid option block.

.. note::
    This method of running the tests defaults to the version of `py.test` that
    is bundled with Astropy. To use the locally-installed version, you should
    either change the `use_system_pytest` configuration option to "True" (see
    :doc:`../../configs`) or the `py.test` method describe above.

There is also a wcs-related error, but I'll report that in a different ticket as it was there before your changes.

@eteq

eteq commented Dec 30, 2011

Copy link
Copy Markdown
Member Author

@astrofrog - that's very odd... I don't see these errors at all. What version of Sphinx do you have? I'm also confused as to how this could possibly trigger errors in testguide.rst, because that's not modified in this pull request...

@astrofrog

Copy link
Copy Markdown
Member

Ok, this error does indeed occur in master using Sphinx 1.1.2, so you can ignore it for this pull request. I fixed it directly in master in 5d338b3.

@eteq

eteq commented Dec 30, 2011

Copy link
Copy Markdown
Member Author

@astrofrog - huh, that fix is very strange - I don't understand why this would have fixed your error... especially given that I built these docs with the same version of sphinx (1.1.2) and they built without complaint. Ah well, if it fixed it, it fixed it, and no harm done!

@astrofrog

Copy link
Copy Markdown
Member

I'm not sure either, but it seems it interpreted :doc: at the start of the indented line to be an option directive. Maybe I was using a developer version of sphinx.

@eteq

eteq commented Dec 30, 2011

Copy link
Copy Markdown
Member Author

Hmm... well, the latest development version seems to currently be at the 1.1.2 release, so unless you were using an older developer version, that should be it. Very strange! But I guess it doesn't matter if it's working for both of us now.

One thing I just realized, though - if I build the docs using python setup.py build_sphinx, it places the generated files in a _generated directory in the source root, instead of in docs. I'll have to figure out how to fix this before we can merge this.

Comment thread astropy/setup_helpers.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just want to reference the discussion on this topic in #117.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point - when the discussion there comes to a resolution, I can either implement it here, or rebase off whatever changes are made.

@mdboom

mdboom commented Jan 5, 2012

Copy link
Copy Markdown
Contributor

Minor point I just noticed while working -- docs/_generated should be added to .gitignore.

@eteq

eteq commented Mar 10, 2012

Copy link
Copy Markdown
Member Author

@astrofrog and @mdboom
I think this is now working the way I had in mind. There are tests, but the coverage isn't that good because a lot of it has to be done in a sphinx context. But If you look at the configuration documentation section, you can see basically what this produces now (there's also a lot more options).

One of the new options is that it is now possible to separate out the documentation for different subpackages/modules of the module being documented. I'll start a broader discussion on the list regarding exactly how often we want to use that, but these extensions now support either way, so it shouldn't affect the PR itself.

@astrofrog

Copy link
Copy Markdown
Member

@eteq - I seem to be getting tons of warnings about generated files: https://gist.github.com/2016457 - is this normal?

@eteq

eteq commented Mar 12, 2012

Copy link
Copy Markdown
Member Author

@astrofrog - That should not be happening... It looks like you tested it using build_sphinx, is that correct? I haven't tested that, mainly because I don't really trust build_sphinx until #171 is implemented. If you instead install astropy (via either setup.py install or setup.py develop), and then use make html in the docs directory, do the warnings go away?

Also, can you look for the _generated directory and tell me if the files it's looking for are actually there? One of the big subtleties I had to fix in this PR involves convincing all the :toctree: <dir> entires to all go into the same directory, so if the _generated directory is in the wrong place, that might explain it.

@astrofrog

Copy link
Copy Markdown
Member

@eteq - ah, I got confused, I thought build_sphinx was the way to go (since the docs require the build documentation). Doing build then make html does work better, and produces the tables with the links to the generated API pages. There is still an error in the middle of make html but it doesn't seem to stop the rest from working:

<autodoc>:0: ERROR: Unexpected indentation.

(see full log here: https://gist.github.com/2020724)

@astrofrog

Copy link
Copy Markdown
Member

By the way, I've just committed a fix for the wrap before the colon in 'Parameters :' - see 7b530ab

@astrofrog

Copy link
Copy Markdown
Member

@eteq - could you push your branch to staging so I can run the tests?

@eteq

eteq commented Mar 12, 2012

Copy link
Copy Markdown
Member Author

@astrofrog - I just pushed to my staging branch - see https://github.com/eteq/astropy/tree/staging.

The <autodoc>:0: ERROR: Unexpected indentation. Is pre-existing - if you go back to master you'll see it's present there as well. I've seen these errors like this before, but they are painful to debug because for some reason autodoc sometimes gets very confused when its used with numpydoc... I generally find them by incrementally removing .rst files until I find which removal that fix it. But I'll do that separate from this pull request given that it's not directly related.

And great that you found a fix for the 'Parameters :' problem! That had been really annoying for some time.

@eteq

eteq commented Mar 15, 2012

Copy link
Copy Markdown
Member Author

@astrofrog , @mdboom , as far as you're concerned, can I merge this?

@astrofrog

Copy link
Copy Markdown
Member

I don't have time to review the code in detail, but it looks like it's working fine, and producing nice output! So from my point of view, this is ready to go.

@mdboom

mdboom commented Mar 15, 2012

Copy link
Copy Markdown
Contributor

Yep -- I'm in the same camp with @astrofrog.

@eteq

eteq commented Mar 15, 2012

Copy link
Copy Markdown
Member Author

Ok, sounds good - merging!

eteq added a commit that referenced this pull request Mar 15, 2012
Adds automodapi and automodsumm sphinx directives, as well as realted doc-building cleanups and fixes.
@eteq
eteq merged commit e217845 into astropy:master Mar 15, 2012
keflavich pushed a commit to keflavich/astropy that referenced this pull request Oct 9, 2013
Adds automodapi and automodsumm sphinx directives, as well as realted doc-building cleanups and fixes.
embray added a commit to embray/astropy that referenced this pull request Jan 23, 2015
Some Python 3 fixes for the import_file utility
@eteq
eteq deleted the docs/automodapi-extension branch May 3, 2015 17:16
astrofrog pushed a commit to astropy/sphinx-automodapi that referenced this pull request Jan 27, 2018
…nsion

Adds automodapi and automodsumm sphinx directives, as well as realted doc-building cleanups and fixes.
astrofrog pushed a commit to astropy/sphinx-astropy that referenced this pull request Jan 29, 2018
…nsion

Adds automodapi and automodsumm sphinx directives, as well as realted doc-building cleanups and fixes.
jeffjennings pushed a commit to jeffjennings/astropy that referenced this pull request Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants