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

Include, rather than write in, significant code examples #67

Open
sadielbartholomew opened this issue Aug 25, 2019 · 5 comments
Open

Include, rather than write in, significant code examples #67

sadielbartholomew opened this issue Aug 25, 2019 · 5 comments
Labels
infrastructure Build system, Sphinx extensions, Deployment etc

Comments

@sadielbartholomew
Copy link
Collaborator

We should aim towards moving all significant chunks of hard-written code out of the .rst content files, & (if not located already in a known place, as in e.g. #65) into a separate dedicated directory as individual files, where they would be written into the built docs from the relevant file by the literalinclude: directive.

This would have various benefits, for example it would:

  • ensure that code snippets written out in the docs are up-to-date &/or consistent with codebase code they are referring to (as in e.g. Update echo xtrigger in line with current (Python 3) code #65);
  • allow us to validate such code for correctness, & against deprecation, certain blocks, notably suite.rc examples;
  • enable us to keep track of the number of code examples, & in turn to reference the figure accurately on the Cylc website as a major asset of the docs, & generally as a positive indicator for quality of project.
@kinow
Copy link
Member

kinow commented Aug 25, 2019

That sounds like a good idea. I suspect it might be a bit boring the whole copy-paste process to get the code out of the documentation.

There is an issue in cylc-sphinx-extensions that I think is related to this issue: cylc/cylc-sphinx-extensions#8

@sadielbartholomew
Copy link
Collaborator Author

There is an issue in cylc-sphinx-extensions that I think is related

Ooh, good spot. Thanks for noting that.

I suspect it might be a bit boring the whole copy-paste process

Yes, you are right there! But not everything can be fun &/or interesting, sadly 😁

@oliver-sanders
Copy link
Member

There is an issue in cylc-sphinx-extensions that I think is related to this issue: cylc/cylc-sphinx-extensions#8

FYI on the validation front it's actually kinda tricky as most code examples are actually snippets which aren't necessarily valid workflows.

@sadielbartholomew
Copy link
Collaborator Author

FYI on the validation front it's actually kinda tricky as most code examples are actually snippets which aren't necessarily valid workflows.

True, good point. But we should certainly aim to validate all of the full suite.rc snippets, & other self-contained logical aspects such as graph strings. In future, we could even develop a set of regular expressions etc. to check for correct & up-to-date syntax for some elements in snippets & bare lines, or for valid section headings from a list, etc. Perhaps a bit OTT, but it would be nice.

@matthewrmshin
Copy link
Contributor

Solving cylc/cylc-flow#2392 may help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infrastructure Build system, Sphinx extensions, Deployment etc
Projects
None yet
Development

No branches or pull requests

4 participants