Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaces astropy-helper with sphinx-astropy #2494

Merged
merged 7 commits into from
Mar 7, 2018

Conversation

yashkgp
Copy link
Contributor

@yashkgp yashkgp commented Mar 1, 2018

Solves Issue #2489

@@ -61,4 +61,4 @@ dependencies:
- glymur
- pip:
- sunpy-sphinx-theme
- git+https://github.com/sphinx-gallery/sphinx-gallery
Copy link
Member

Choose a reason for hiding this comment

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

sphinx-gallery and sphinx-astropy do two different things we are going to need both 😄

@@ -29,14 +29,7 @@
import datetime
import sys

ON_RTD = os.environ.get('READTHEDOCS') == 'True'
Copy link
Member

Choose a reason for hiding this comment

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

I think we are still going to need all of this RTD stuff.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we check if we do need this?

Copy link
Member

Choose a reason for hiding this comment

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

See comment below, we are now importing it from sphinx astropy

docs/conf.py Outdated
os.environ['HOME'] = '/home/docs/'
os.environ['LANG'] = 'C'
os.environ['LC_ALL'] = 'C'
import astropy
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need this.

Fixes typo

Small requested changes

 requested changes

small changes
@nabobalis
Copy link
Contributor

nabobalis commented Mar 2, 2018

I think down the road we can remove sphinx-gallery since its one of the dependencies for sphinx-astropy. But since it has't had a release for a while, we still need to use master.

Issue is now we have one warning in the doc build but having a quick glance, I can't find it.

@Cadair
Copy link
Member

Cadair commented Mar 2, 2018

/home/travis/build/sunpy/sunpy/build/lib.linux-x86_64-3.6/sunpy/spectra/spectrum.py:docstring of sunpy.spectra.spectrum.Spectrum:34: WARNING: Inline strong start-string without end-string.

docs/conf.py Outdated
@@ -174,14 +166,13 @@
napoleon_google_docstring = False

# -- Options for the edit_on_github extension ----------------------------------------
extensions.remove('astropy_helpers.extern.numpydoc')
Copy link
Member

Choose a reason for hiding this comment

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

we still need to remove this, jut from astropy_sphinx instead. It's possible this is what's causing the doc warning.

Copy link
Contributor Author

@yashkgp yashkgp Mar 2, 2018

Choose a reason for hiding this comment

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

But extensions in astropy_sphinx does not contain astropy_helpers.extern.numpydoc, will raise an error if removed . Also numpydocs should be removed from extensions, right ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Cadair ping

Copy link
Member

Choose a reason for hiding this comment

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

yeah in astropy_sphinx it looks like it's just numpydoc we need to pop (https://github.com/astropy/sphinx-astropy/blob/master/sphinx_astropy/conf/v1.py#L135)

@Cadair
Copy link
Member

Cadair commented Mar 2, 2018

I have just had a look through the conf.py file, and while this is very much not your fault, it's a bit of a mess, and could do with a tidy. This seems like an opportune time to tidy it up where appropriate.

Firstly, a quick bit of background. Sphinx imports conf.py and then uses any variables that are defined in that file to configure itself, i.e. it looks for a variable named extensions in conf.py to know what extensions to load (it will not use any variables in the file it is not expecting to be there).

How we organise our conf.py file is that we import the one from astropy_helpers or now sphinx_astropy and then modify things as we need to. This means we re-define some variables outright, and append or delete things from the lists and dictionaries we have imported from the astropy config.

What would be nice to do is to look through the conf/v1.py file in sphinx_astropy and find places where we duplicate things in that file or re-define things to be the same etc. Obvious ones I can see are intersphinx_mapping and on_rtd.

Then also feel free to re-format our conf.py to be as succinct as possible. The main changes we make to the default config in astropy_sphinx are:

  • Use our HTML theme
  • remove h5py from intersphinx and add sqlalchemy, pandas and skimage.
  • use napoleon instead of numpy doc
  • extra config for sphinx-gallery.

Also worth looking at is the conf.py for the sunpy theme, as it looks like we are re-defining one or two variables from that as well.

Thanks!

@yashkgp
Copy link
Contributor Author

yashkgp commented Mar 2, 2018

Thanks for the help @Cadair ,will update the conf.py ASAP.

docs/conf.py Outdated
@@ -174,6 +172,9 @@
napoleon_google_docstring = False
extensions += ['sphinx_astropy.ext.edit_on_github', 'sphinx.ext.doctest', 'sphinx.ext.githubpages']

# Remove numpydoc
Copy link
Member

Choose a reason for hiding this comment

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

Can you put this directly above the extensions.append('sphinx.ext.napoleon') line?

Also the napoleon config seems to be duplicated? Can you remove the one not under the "swap to napoleon" comment?

@yashkgp yashkgp closed this Mar 6, 2018
@yashkgp yashkgp reopened this Mar 6, 2018
Copy link
Member

@Cadair Cadair left a comment

Choose a reason for hiding this comment

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

I think this is very close! Just a couple of little tweaks.

CHANGELOG.rst Outdated
@@ -42,6 +42,8 @@ Bug Fixes
- Updates MapCube to access the correct properties of the namedtuple SpatialPair [#2297]
- Fixed TimeSeries test failures due to missing test files [#2273]
- Refactored a GOES test to avoid a Py3.6 issue [#2276]
- The documentation build now uses the Sphinx configuration from sphinx-astropy
rather than from astropy-helpers.
Copy link
Member

Choose a reason for hiding this comment

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

this needs the pr number in square brackets at the end.

extensions.append('sphinx.ext.napoleon')

# Disable having a separate return type row
napoleon_use_rtype = False
# Disable google style docstrings
napoleon_google_docstring = False

# -- Options for the edit_on_github extension ----------------------------------------
Copy link
Member

Choose a reason for hiding this comment

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

This comment should still be here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

Choose a reason for hiding this comment

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

This was moved to the wrong part of the file?

@@ -7,3 +7,4 @@
sphinx
sunpy-sphinx-theme
sphinx-gallery
sphinx_astropy
Copy link
Member

Choose a reason for hiding this comment

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

the pip name is sphinx-astropy not sphinx_astropy.

(yes, yes it's a very confusing convention lol)

@Cadair Cadair requested a review from nabobalis March 7, 2018 11:39
ON_TRAVIS = os.environ.get('TRAVIS') == 'true'

if ON_RTD:
if on_rtd:
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be ON_RTD

Copy link
Member

Choose a reason for hiding this comment

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

No, we now import this from sphinx_astropy and it's lower case.

Copy link
Contributor

Choose a reason for hiding this comment

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

OH FAIR ENOUGH I SHOULD HAVE CHECKED

@@ -200,7 +185,7 @@

# -- Options for the Sphinx gallery -------------------------------------------

if ON_RTD and os.environ.get('READTHEDOCS_PROJECT').lower() != 'sunpy':
if on_rtd and os.environ.get('READTHEDOCS_PROJECT').lower() != 'sunpy':
Copy link
Contributor

Choose a reason for hiding this comment

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

ON_RTD

@@ -902,7 +902,8 @@ def test_fetch(database, download_query, tmpdir):
database.undo()
assert len(database) == 0
database.redo()
assert len(database) == 4
# Make this resilitent to vso changes while we chase this up with VSO 2018-03-07
assert len(database) in (2, 4)
Copy link
Contributor

Choose a reason for hiding this comment

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

THIS IS MAGIC, WHY DIDNT I DO THIS.

@nabobalis nabobalis merged commit 069b8ab into sunpy:master Mar 7, 2018
@Cadair
Copy link
Member

Cadair commented Mar 7, 2018

Thanks @yashkgp this is awesome!

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.

None yet

3 participants