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

Creating docs automatically for scancode data #2455

Closed
1 of 5 tasks
robinsingh-ai opened this issue Mar 25, 2021 · 1 comment
Closed
1 of 5 tasks

Creating docs automatically for scancode data #2455

robinsingh-ai opened this issue Mar 25, 2021 · 1 comment

Comments

@robinsingh-ai
Copy link

robinsingh-ai commented Mar 25, 2021

Description

I have seen this new project idea where we have to create docs automatically from scancode data, these can be done using automodule method from autodoc extension,

but as @AyanSinhaMahapatra you mentioned on gitter that "we want something that parses more specifically, since the data we want to show, is only a small part of the classes, i.e. there will be (a lot) of functions and methods also documented which we don't want. We likely have to craft something similar but more specific to our requirements, which only takes out certain docstrings/class attributes having the documentation for that data field, and creates the doc from there."

Solution

autodoc is an extension of the sphinx which is used to Include documentation from docstrings that is available inside the source code, so there are many in-built methods that are available in the autodoc extension like automodule, autoclass and autoexception etc.

  • .. automodule:: : which can be used to import any source file having all the classes and functions
  • .. autoclass:: : which can be used to import any class inside the source program.
  • The key to using these features is the :members: attribute. If:
    • If we don’t include it at all, only the docstring for the object is brought in:
      • For example if we import api.py from src/scancode then sphinx will only parses this dockstring
        Screenshot from 2021-03-25 15-18-53
    • if we just use :members: with no arguments, then all public functions, classes, and methods are brought it that have a docstring.
    • If we explictly list the members like :members: <function_1>, <function_2>, <function_3> those explict members are brought.

For more refer this

So like this way, we can only parse that data that we want to show in docs

@MaJuRG and @AyanSinhaMahapatra need your suggestion on this solution
looking forward to your reply

Select Category

  • Inconsistency
  • New Section Request
  • General Improvement
  • Typo/Mistakes
  • Other
@AyanSinhaMahapatra
Copy link
Member

A duplicate issue, closing this. See #2008 and #2425

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants