Skip to content

autogenerate API documentation #479

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

Merged
merged 46 commits into from
Sep 20, 2018
Merged

Conversation

n2ygk
Copy link
Contributor

@n2ygk n2ygk commented Sep 14, 2018

Fixes #478

Description of the Change

Autogenerate API reference documentation from the Python docstrings, superseding docs/api.md which is out of date.

Checklist

  • PR only contains one change (considered splitting up PR)
  • documentation updated
  • changelog entry added to CHANGELOG.md
  • author name in AUTHORS

@n2ygk
Copy link
Contributor Author

n2ygk commented Sep 14, 2018

I'm not quite sure if I the .travis.yml update I did is actually useful....

Adding tox -e sphinx I think is useful as one can at least locally regenerate the docs to see if the docstrings are useful/readable.

@n2ygk n2ygk requested a review from sliverc September 15, 2018 20:34
@n2ygk
Copy link
Contributor Author

n2ygk commented Sep 15, 2018

@sliverc please take a look at this. I'm not sure how to test pushing these changes to readthedocs.org

@n2ygk
Copy link
Contributor Author

n2ygk commented Sep 15, 2018

I seem to have figured out how to test RTD. See https://testing-django-rest-framework-json-api.readthedocs.io/en/sphinx-apidoc/

Copy link
Member

@sliverc sliverc left a comment

Choose a reason for hiding this comment

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

Nice work 👍 This is a good improvement to our documentation.

I am not a sphinx expert but I have seen in other projects that it should be completely auto generatable without the need of a bunch of apidoc rst files.

One of them is SpiffWorkflow. Maybe we can have a look there how it is done. Makes maintaining API documentation even easier as we do not have to think about adding any new modules to the sphinx doc.

@n2ygk
Copy link
Contributor Author

n2ygk commented Sep 17, 2018

I am not a sphinx expert but I have seen in other projects that it should be completely auto generatable without the need of a bunch of apidoc rst files.

Those apidoc files are "autogenerated" by sphinx-apidoc (via tox -e sphinx) but I would love to not even have to remember to do that step since the updated files then have to be committed/pushed. I'll try and take a look at SpiffWorkflow or other options, unless your or someone else wants to chime in with a commit here, which I would welcome.

Should use reST or MarkDown in docstrings? I prefer the later, but it seems reST is the dominant case and it's not a big deal to have to use .. code:: python instead of ```python

@sliverc
Copy link
Member

sliverc commented Sep 17, 2018

@n2ygk Let's use reST as it is more powerful and in the long run I would prefer that we only use reST in the whole project (otherwise it is fairly confusing in what context what markup language needs to be used)

I unfortunately do not have a lot of experience with sphinx so if someone else with experience could look at this as well that would be great.

@n2ygk
Copy link
Contributor Author

n2ygk commented Sep 18, 2018

@sliverc this is based off my latest commits to #481 based on your review. Assuming you merge that with no further changes, this should also be ready for review and squash merge.

@n2ygk n2ygk changed the title WIP: sphinx-apidoc autogenerate API documentation autogenerate API documentation Sep 18, 2018
@n2ygk n2ygk added this to the 2.6.0 milestone Sep 18, 2018
@sliverc
Copy link
Member

sliverc commented Sep 19, 2018

Great work.

Two comments:

  • Could you resolve the merge conflicts and rebase with master?
  • The API reference of filters promotes sort and queryvalidation package, although the API we want to promote would be rather filters import directly. DRF also adds their filter backends into one module and does not split it up into several files. I guess we could do the same? I would prefer it.

@n2ygk
Copy link
Contributor Author

n2ygk commented Sep 19, 2018

  • The API reference of filters promotes sort and queryvalidation package, although the API we want to promote would be rather filters import directly. DRF also adds their filter backends into one module and does not split it up into several files. I guess we could do the same? I would prefer it.

I will stick them back together. Even though filters/__init__.py makes it look that way by importing from the sort.py and queryvalidation.py, that isn't apparent from the sphinx autoapi.

Copy link
Member

@sliverc sliverc left a comment

Choose a reason for hiding this comment

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

Great. Thanks.

@sliverc sliverc merged commit 4eef958 into django-json-api:master Sep 20, 2018
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.

2 participants