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

Set up Sphinx documentation #51

Merged
merged 13 commits into from
Aug 3, 2020
Merged

Set up Sphinx documentation #51

merged 13 commits into from
Aug 3, 2020

Conversation

tomwhite
Copy link
Collaborator

This is the initial work to set up docs for the project, following discussion in #19.

  • Uses Sphinx reStructuredText
  • Currently very barebones, but shows the two top-level functions
  • Uses the ReadTheDocs theme
  • Hosted on GitHub pages at https://pystatgen.github.io/sgkit/ (at least for the moment)
  • Docstring style is numpydoc, but Google-style docstrings are supported due to use of sphinx.ext.napoleon
  • Xarray types in the documentation are automatically converted to links (using sphinx.ext.intersphinx ). Note that these types must be specified using reST, e.g. :class:`xarray.Dataset`

To generate and view docs locally:

cd docs
make html
open _build/html/index.html

@jeromekelleher
Copy link
Collaborator

LGTM. What's the plan for deploying to gh-pages?

@tomwhite
Copy link
Collaborator Author

What's the plan for deploying to gh-pages?

Use a GitHub Action to deploy to the gh-pages branch on every commit to master. I think that's the simplest thing to do until we have our first release and want different versions.

@hammer
Copy link
Contributor

hammer commented Jul 20, 2020

Amazing, thanks @tomwhite!

What are your thoughts on how we could incorporate docs from related packages like sgkit-plink and sgkit-bed?

@tomwhite
Copy link
Collaborator Author

What are your thoughts on how we could incorporate docs from related packages like sgkit-plink and sgkit-bed?

Good question. One option would be to generate self-contained docs for each package, and interlink them using sphinx.ext.intersphinx. Since the IO projects have a very small API, I would prefer to just add their docs as separate pages on the main site. We'd author the reST docs there, and pull in the API definitions by importing the modules in the Sphinx conf file.

@hammer
Copy link
Contributor

hammer commented Jul 20, 2020

@tomwhite do we need a follow up issue for that or is it easy enough to just incorporate into this PR and document for others?

@tomwhite
Copy link
Collaborator Author

I think it needs some extra work, so I've opened #54

@tomwhite
Copy link
Collaborator Author

I fixed a broken link in the generated doc at https://pystatgen.github.io/sgkit/

@tomwhite
Copy link
Collaborator Author

I made changes so that the build will fail if Sphinx documentation warnings are introduced. I've also added a workflow to publish the docs to gh-pages when anything is committed to master (but I can't fully test that until this is merged).

Reviews and suggestions welcome!

@tomwhite
Copy link
Collaborator Author

tomwhite commented Aug 3, 2020

I've rebased this. Any objections to merging this? It will allow us to press on with writing docs.

- name: Check for Sphinx doc warnings
run: |
cd docs
make html SPHINXOPTS="-W --keep-going"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This isn't a blocker on merging, but any particular reason for not making this strict? In my experience people writing docs will make lots of mistakes, and the only way to catch these is to have strict checking on and to verify it as part of CI. Otherwise the docs get cruddy pretty quickly when less experienced developers start contributing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We could enable "nit-picky mode" (-n). I tried doing this, but it generated some errors that will need a bit more work to fix. I've opened https://github.com/pystatgen/sgkit/issues/86

@jeromekelleher
Copy link
Collaborator

I think we should merge this ASAP - having some functional docs infrastructure is vital at this point.

@tomwhite tomwhite merged commit 8302d22 into sgkit-dev:master Aug 3, 2020
@tomwhite tomwhite deleted the docs branch August 3, 2020 12:39
@tomwhite
Copy link
Collaborator Author

tomwhite commented Aug 3, 2020

Thanks for the review @jeromekelleher

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