-
Notifications
You must be signed in to change notification settings - Fork 54
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
Sphinx documentation. #2046
Sphinx documentation. #2046
Conversation
c50dd56
to
33a7a79
Compare
867bd01
to
9107f7b
Compare
9107f7b
to
5052fac
Compare
Updates:
Info:
Automated deployment:
travis.yml install:
...
- pip install sphinx
script:
- make -C doc doctest html && deploy-script "${PWD}"
- rose test-battery ... deploy-script #!/bin/bash
ROSE_DIR=$1
# Only deploy on merge to master.
if [[ "${TRAVIS_BRANCH}" != 'master' || \
"${TRAVIS_PULL_REQUEST}" != 'false' ]]; then
# Documention should not be deployed.
echo 'Skipped Deployment.'
exit 0
fi
git clone 'https://github.com/davisp/ghp-import'
echo 'Deploying documentation ...'
# Place docs in "doc" directory for historic reasons.
echo -e '\tSymlinking documentation into site structure...'
GHP_DIR="$(mktemp -d)"
ln -s "${ROSE_DIR}/doc" "${GHP_DIR}/doc"
ln 'index.html' "${GHP_DIR}/index.html"
# Push new documentation.
echo -e '\tConstructing gh-pages branch...'
./ghp-import/ghp_import.py -ln "${GHP_DIR}"
echo -e '\tpushing gh-pages branch...'
git push -fq "https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git" gh-pages
echo -e '\tDeployment successfull.' setup:
|
Note the test battery now builds the docs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 minor issues:
venv/
directory not cleaned up.t/syntax/01-doc.t
failed in my environment.
Looks good otherwise.
Test not happy. |
54e5c23
to
8bfd53c
Compare
Test now ecstatic. |
@arjclark please sanity check. |
lib/python/rose/config.py
Outdated
|
||
""" | ||
node = self.load(source, node) | ||
if not node: | ||
node = self.load(source, node) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noticed that this change will break loading of site/user global configuration. After this change, user global will never get loaded because node
will be defined. Please revert.
66d50b2
to
9a2ab0f
Compare
* Fixes traceback for a rose macro without a docstring
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Various minor comments. @matthewrmshin, as dicussed, can you double check the docsting entries for confignode are consistent with behaviour?
doc/rose-api.html
Outdated
@@ -785,7 +785,8 @@ <h2 id="macro">Rose Macros</h2> | |||
e.g. adding/removing options.</li> | |||
|
|||
<li>Upgraders - these are special transformer macros | |||
for upgrading and downgrading configurations.</li> | |||
for upgrading and downgrading configurations. (covered in the | |||
<a href="#upgrade">next section</a>)</li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you describe this as the "upgrade" section rather than "next"
doc/rose-config-api.html
Outdated
</div> | ||
|
||
<div class="panel-body"> | ||
<p>View the API docs <a href="rose-config-api.html">here</a>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please close the <p>
tag for consistency
|
||
# General information about the project. | ||
project = u'rose-api-documentation' | ||
copyright = u'2017, Met Office' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do some strings in here have the unicode markup while others don't?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the way Sphinx auto-generates them, I don't imagine it's necessary though.
doc/sphinx/sphinx.rst
Outdated
|
||
""" # Blank line. | ||
|
||
def __init(self, param1, param2, kwarg=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be __init__
?
|
||
Args: | ||
filename (str): The filename of the resource to request the path | ||
to. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alignment of this looks odd - maybe in line with the "T"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the google docstring convention (overflow lines should have an extra 4 space indentation) see the guide I wrote in doc/sphinx/sphinx.rst and also http://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html.
lib/python/rose/config.py
Outdated
@@ -459,13 +996,36 @@ def get_reversed(self): | |||
return rev_diff | |||
|
|||
def delete_removed(self): | |||
"""Deletes all 'removed' keys from this diff.""" | |||
"""Deletes all 'removed' keys from this ConfigNodeDiff.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only the one "."
doc/rose-api.html
Outdated
@@ -963,6 +970,8 @@ <h4 id="macro:code:api">API Reference</h4> | |||
|
|||
<pre class="prettyprint"> | |||
def report(self, config, meta_config=None): | |||
""" Write some information about the configuration to a report file.""" | |||
# Note: report methods do not have a return value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you combine the docstring and the immediately following # comment
9a2ab0f
to
1a52ec7
Compare
Assuming @matthewrmshin has confirmed the ConfigNode docstring entries are consistent with behaviour then good to merge. |
NOT READY FOR REVIEW.Closes #1686
This change adds API reference pages auto-generated by the Sphinx (GPL) documentation builder.
t/docs/03-sphinx-doctests.t
.Wrapper script for building docs can be found atUsedoc/bin/make-docs
.make -C doc html
to build.Supply the wrapper script to build using a virtualenv. Implemented via makefileRely on user installation.doc/sphinx/_build/sphinx.html
(have to be built).rose.config.*
,rose.macro.MacroBase
,rose.macro.MacroReporter
.At present Sphinx is being used for its autodoc feature but is capable of building entire sites (e.g. www.docs.python.org).
Currently the default Sphinx theme is being used (same as the python2 docs), other themes are available, see in particular:readthedocssphinx-bootstrapThere are also two small behaviour changes brought in by this pull:
rose.config.ConfigNodeDiff
.(set_added_setting
,set_modified_setting
,set_removed_setting
) methods can now be provided as a list as well as a tuple for consistency withrose.config.ConfigNode
.A bit of polish is still required - putting this up for comment @metomi/core.Building of docs needs to be automated in our git workflowDitched Travis build/deploy scriptsBuild scripts require improvementTransitioned to makefile