Documentation content#13
Conversation
3e7ae29 to
83792c8
Compare
docs/source/introduction.rst
Outdated
|
|
||
| Then you can work with NextCloud objects: | ||
|
|
||
| .. code-block:: python |
There was a problem hiding this comment.
This looks good so far, if you want to improve it, consider making the documentation based on tests - now, you have manually written some example code, but if you would include code from a test, it would guarantee that the code is always up-to-date, performing as expected. The sphinx literalinclude directive has huge possibilities in this regard, for example start-after and end-before (you can use special comments as anchors).
There was a problem hiding this comment.
I also added code examples to example.py file and linked them in separate Examples page in documentation. Should I delete that file and link all the examples from tests ?
Thanks!
There was a problem hiding this comment.
My point was that it may happen that the documentation falls out of sync with actual state, if it is not tested. Extracting the code into a separate file is surely a step forward, but if the example is not tested, then it is still not "there".
However, I feel that we are quite close - if you insert some asserts there, for example create a user, then assert that it exist when you list all users, you remove it, it doesn't exist etc., then you not only have a test for free, but users and readers exactly know what behavior to expect. And the only thing to figure out would be how to include that in an actual test.
But I think that sharing the file to a container and executing it using the python interpreter should do the trick - it just has to be documented in the test README.
There was a problem hiding this comment.
I understand. I added asserts to example.py code and linked it in Introduction as quick start examples and it looks good.
Should we include examples of all methods like this in separate Examples page in documentation on the beginning of the project? Because it will take a lot of time and will be almost the same as copy-pasting tests but without self.nxc and asserts in between the code.
There was a problem hiding this comment.
Of course not, you are right - no copy pasting! I like changes to the example. Let's stick with it for the time being, more docs can always be added in another PR.
|
I have also noticed that the |
d83b9d5 to
0f2f2d6
Compare
|
This looks pretty good, please rebase so it is clearly visible what got added. I feel that this is close to being merged. |
…art of tests; introduction quick start from example.py
fd8fdc5 to
b74b920
Compare
|
The inspection completed: 1 new issues |
|
@matej rebased against master |
|
Good job, merging. |
|
Nice, check out https://nextcloud-api.readthedocs.io/en/latest/ ! |
|
Much better now! However, examples and api index page still needs improvement. |
Set up documentation structure;
Add Introduction, Examples, api reference;