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

added spinix.ext.napoleon to sphinx extensions #5

Merged
merged 2 commits into from
Dec 17, 2021

Conversation

abrown41
Copy link

I recently used this cookie cutter template having seen it in action at the SeptemRSE conference. I then spent three weeks trying to make sphinx work with my code (I have never used sphinx before). It turned out a particular doc-string in pandas.core.frame doesn't play nicely with numpydoc unless you have the sphinx.ext.napoleon extension enabled.

Given that a lot of scientific python projects will probably use pandas DataFrames, and that many of the people you want to use this cookie cutter template may not have used sphinx before, this PR adds the extension to the list in docs/source/conf.py to save them the pain.

@bielsnohr bielsnohr self-requested a review December 3, 2021 11:53
@bielsnohr
Copy link
Member

bielsnohr commented Dec 3, 2021

Thanks for the contribution @abrown41 and sorry for taking so long to reply. For some reason the notification didn't come through to me by email.

It is great to get feedback from those using the template. This sounds like a very sensible change, but I will just need to quickly test it before agreeing to merge in. I don't imagine it will cause any trouble.

@bielsnohr
Copy link
Member

After a lot of struggling, I discovered that having both numpydoc and sphinx.ext.napoleon seems to cause the very basic example used for testing to fail. It runs fine if only one or the other is enabled. The error if both are enabled:

Warning, treated as error:
/home/mbluteau/work/projects/scientific-python-cookiecutter/example/docs/source/autoapi/example/_version/index.rst:179:Explicit markup ends without a blank line; unexpected unindent.

@abrown41 Did you come across this? By the looks of this PR you have both enabled, which is surprising.

Given that napoleon can handle both Google style and numpy style docstrings, I am inclined to use it instead of numpydoc, but I will wait to hear back.

Copy link
Member

@bielsnohr bielsnohr left a comment

Choose a reason for hiding this comment

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

As mentioned in previous comments, this suggestion to use napoleon seems sensible, although it appears from testing that numpydoc should not be used at the same time, so I have suggested it be removed.

{{ cookiecutter.repo_name }}/docs/source/conf.py Outdated Show resolved Hide resolved
Remove use of numpydoc in favour of sphinx.ext.napoleon
@bielsnohr bielsnohr merged commit bd01021 into ukaea:main Dec 17, 2021
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.

2 participants