-
Notifications
You must be signed in to change notification settings - Fork 8
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
cylc domain #13
cylc domain #13
Conversation
8ce950b
to
c394af1
Compare
The Travis build is failing due to an interaction between hieroglyph + docutils==0.16.0 For now I've pinned docutils to <0.16.0 until the cause/workaround is determined. Booted to #14 |
5143918
to
374b469
Compare
NOTE: This can go in before cylc/cylc-flow#3253 is attempted, the autodocumenter will need to be updated to work with whatever replaces the |
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.
Some typos, but I don't think we need to fix all of them? This is a module used mainly by ourselves, so feel free to resolve any typo if that doesn't result in a typo in the generated doc 👍 (I am not sure whether they do or not).
Tried to simply build it with:
- Check out branch
- Create new Py3 virtual env
pip install -e .[all]
- Repeat above in
../cylc-flow
to get latest Cylc Flow module make html singlehtml
Then it failed with the following error:
Warning, treated as error:
/home/kinow/Development/python/workspace/cylc-sphinx-extensions/venv/lib/python3.7/site-packages/sphinx/ext/autosummary/templates/autosummary/base.rst:3:Error in "currentmodule" directive:
maximum 1 argument(s) allowed, 3 supplied.
.. currentmodule:: {{ module }}
Makefile:23: recipe for target 'html' failed
make: *** [html] Error 2
@oliver-sanders is that expected until cylc/cylc-flow#3253 is done? If so will approve this PR.
def process_link(self, env, refnode, has_explicit_title, title, target): | ||
# copy ref_context to the refnode so that we can access it in | ||
# resolve_xref. Note that walking through the node tree to extract | ||
# ref_context items appears only to work in the HTML buider. |
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.
s/buider/builder
Hmmm, curious, |
I think the |
I can't replicate this ATM, here's my attempt to reproduce: $ conda create -y -n cse
$ conda activate cse
$ conda install -y -c conda-forge python==3.7
$ cd ~/cylc-flow/; pip install -e .[all]
$ cd ~/cylc-sphinx-extensions; pip install -e .[all]
$ conda install graphviz # one thing we cant package with pip
$ make clean html Is your virtualenv pulling in Sphinx or Docutils from the base installation? import sphinx
print(
sphinx.__version__
sphinx.__file__
)
import docutils
print(
docutills.__version__,
docutills.__file__
) |
Ooh, actually try this: diff --git a/index.rst b/index.rst
index 5b53b99..1bb0b5a 100644
--- a/index.rst
+++ b/index.rst
@@ -5,7 +5,6 @@ Available Extensions
.. autosummary::
:toctree: extensions
- :template: mymodule.rst
cylc.sphinx_ext.cylc_lang
cylc.sphinx_ext.diff_selection |
I was installing (cse) kinow@kinow-VirtualBox:~/Development/python/workspace/cylc-sphinx-extensions$ rm _templates/mymodule.rst
(cse) kinow@kinow-VirtualBox:~/Development/python/workspace/cylc-sphinx-extensions$ make clean html
rm -r extensions/ || true
Removing everything under '_build'...
# build documentation
Running Sphinx v2.4.1
making output directory... done
[autosummary] generating autosummary for: README.rst, index.rst, venv/lib/python3.7/site-packages/Jinja2-2.11.1.dist-info/LICENSE.rst, venv/lib/python3.7/site-packages/Rx-1.6.1.dist-info/DESCRIPTION.rst, venv/lib/python3.7/site-packages/alabaster-0.7.12.dist-info/DESCRIPTION.rst, venv/lib/python3.7/site-packages/ansimarkup-1.4.0.dist-info/DESCRIPTION.rst, venv/lib/python3.7/site-packages/certifi-2019.11.28.dist-info/DESCRIPTION.rst, venv/lib/python3.7/site-packages/chardet-3.0.4.dist-info/DESCRIPTION.rst, venv/lib/python3.7/site-packages/codecov-2.0.15.dist-info/DESCRIPTION.rst, venv/lib/python3.7/site-packages/hieroglyph-1.0.0.dist-info/DESCRIPTION.rst, ..., venv/lib/python3.7/site-packages/imagesize-1.2.0.dist-info/LICENSE.rst, venv/lib/python3.7/site-packages/importlib_metadata/docs/changelog.rst, venv/lib/python3.7/site-packages/importlib_metadata/docs/index.rst, venv/lib/python3.7/site-packages/importlib_metadata/docs/using.rst, venv/lib/python3.7/site-packages/pycodestyle-2.5.0.dist-info/DESCRIPTION.rst, venv/lib/python3.7/site-packages/pytest_cov-2.8.1.dist-info/AUTHORS.rst, venv/lib/python3.7/site-packages/pytz-2019.3.dist-info/DESCRIPTION.rst, venv/lib/python3.7/site-packages/sphinx/ext/autosummary/templates/autosummary/base.rst, venv/lib/python3.7/site-packages/sphinx/ext/autosummary/templates/autosummary/class.rst, venv/lib/python3.7/site-packages/sphinx/ext/autosummary/templates/autosummary/module.rst
Exception occurred:
File "/home/kinow/anaconda3/envs/cse/lib/python3.7/site-packages/sphinx/jinja2glue.py", line 213, in get_source
raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: mymodule.rst
The full traceback has been saved in /tmp/sphinx-err-ub5fjd5s.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
Makefile:23: recipe for target 'html' failed
make: *** [html] Error 2
|
Checked out the reading sources... [100%] venv/lib/python3.7/site-packages/sphinx/ext/autosummary/templates/autosummary/module
Warning, treated as error:
/home/kinow/Development/python/workspace/cylc-sphinx-extensions/venv/lib/python3.7/site-packages/importlib_metadata/docs/index.rst:24:toctree contains reference to nonexisting document 'venv/lib/python3.7/site-packages/importlib_metadata/docs/changelog (links)'
Makefile:23: recipe for target 'html' failed
make: *** [html] Error 2 |
(sorry, you need to apply the diff rather than remove the file, corrected comment above) |
Diff applied (first time I had the error there were no new files, but I later I tried git clean -d -f to make sure no new files were causing this error). Still same error (tried with
venv conda It could be something else in my environment. Maybe another reviewer could try it later and see if that works. I can also try from home later today to check if I get the same error or not? |
Those versions match what I'm testing with and the paths look file. I have no idea what's going wrong for you. The tests are passing on Travis, for info all Travis does to install is this:
The only thing left is to examine the full traceback stack, you'll find this in the sphinx output:
Perhaps post to Riot as it'll be quite long. |
That traceback was from when I did a
It must be something I'm doing wrong. Just tried at home, and got the same error. Will try to copy the Travis installation steps and see if that works for me. Thanks! |
@oliver-sanders found it! And the cause was my I decided to search for that error, and got few uninteresting results. And one in Japanese (normally I see those in Japanese or Chinese and ignore). But this one was spot on, even the solution/explanation was good.
And the solution worked for me:
But I had to include the following: diff --git a/conf.py b/conf.py
index 9d04f02..662df75 100644
--- a/conf.py
+++ b/conf.py
@@ -59,3 +59,8 @@ autosummary_imported_members = True
intersphinx_mapping = {
'sphinx': ('http://www.sphinx-doc.org/', None)
}
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = ['_build', 'venv']
+ With conda it failed because I had not deleted my Approving the PR. But as others could use Thanks for the help troubleshooting it! |
Aah, creating a virtualenv in the root directory, nice detective work, have applied your fix. |
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.
Checks
- Read the changes
- Checked out and tried using it (followed @kinow 's process)
Comments
- A few spelling errors - I added suggestions to make correcting these easier.
- Had to specify Python 3.7 in
conda create
- 3.8 cause a failure topip install pyzmq
- this may be an issue ahead? - How long should the "singlehtml" output be? It looked a bit short to me:
> cat $PWD/_build/singlehtml/index.html | wc -l
323
Never tried singlehtml, the "stub" pages don't seem to get included, no idea, shouldn't matter though. |
|
* don't include class/function tables as the stub-pages for these objects won't have been created so will cause referencing errors
Co-Authored-By: Tim Pillinger <26465611+wxtim@users.noreply.github.com>
1693d83
to
27bbdc9
Compare
Two approvals, and all checks passing. LGTM |
Closes #11
Partly addresses #12
It's hard-to-review code-bomb time! Sorry! I'll try to comment this better to help.
The code is documented in module docstrings, you can build it with:
(note: the docs use a strict build so building the docs also tests them)
Cylc Domain
Create a Sphinx domain for documenting Cylc configurations. This allows us to document settings as objects which we can reference throughout the Cylc documentation (and via inter-sphinx any Sphinx project).
Benefits:
Definition examples:
Cylc configurations can be documented manually like this:
Reference examples:
Once defined objects can be referenced like this:
:cylc:conf:'suite.rc'
:cylc:section:'[runtime]'
:cylc:setting:'[scheduling]max active cycle points'
Cylc AutoDocumenter
This PR also adds a POC autodocumenter which can document Cylc configurations from
SPEC
dictionaries (at present only type, default and options are available). This will need to be re-worked when we build documentation into Cylc configurations.Parsec examples:
Parsec types can be be autodocumented like so (requires cylc/cylc-flow#3439):
.. auto-cylc-type:: cylc.flow.parsec.validate.ParsecValidator.V_TYPE_HELP cylc.flow.parsec.validate.CylcConfigValidator.V_TYPE_HELP
Cylc examples:
Cylc configs can be autodocumented like so: