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

Add readthedocs documentation to Scribe-Data #57

Closed
2 tasks done
andrewtavis opened this issue Nov 14, 2023 · 16 comments
Closed
2 tasks done

Add readthedocs documentation to Scribe-Data #57

andrewtavis opened this issue Nov 14, 2023 · 16 comments
Assignees
Labels
documentation Improvements or additions to documentation feature New feature or request help wanted Extra attention is needed

Comments

@andrewtavis
Copy link
Member

Terms

Description

This issue would be to add in readthedocs for Scribe-Data. Goal would be to have all functions and classes automatically documented.

Contribution

Happy to support with this! We should discuss implementation beforehand, but I've used readthedocs extensively for other projects and am happy to help with setup or add parts to the docs.

@andrewtavis andrewtavis added documentation Improvements or additions to documentation feature New feature or request help wanted Extra attention is needed labels Nov 14, 2023
@andrewtavis
Copy link
Member Author

CC @m-charlton 😊 Let me know how you'd like to start on this!

@shashank-iitbhu
Copy link
Contributor

assign @andrewtavis

@andrewtavis
Copy link
Member Author

Thank you @shashank-iitbhu!

@m-charlton
Copy link
Contributor

m-charlton commented Feb 3, 2024 via email

@andrewtavis
Copy link
Member Author

Great to hear from you, @m-charlton! Plan is to get the baseline for this up for @shashank-iitbhu later today. We can talk about this here in the issue and also check into the work for the doc strings in #56 :)

@andrewtavis
Copy link
Member Author

Ok all 😊 We now have the base docs available at scribe-data.readthedocs.io, and the GitHub integration is working fine on commits to the repo 🙌 In setting it up, for some reason the modules weren't being loaded in though. I'm wondering if maybe we didn't have the current __init__.py structure when the last release was made? Not sure. My assumption is that the following in utils.rst should work:

utils
=====

The :py:mod:`utils` module provides utility functions for data extraction, formatting and loading.

.. automodule:: scribe_data.utils
    :members:
    :private-members:

What we're getting though is:

WARNING: autodoc: failed to import module 'utils' from module 'scribe_data'; the following exception was raised:
No module named 'scribe_data.utils'

Similarly for checkquery. Let's share some thoughts, and then I think we should be good to try out automodule with other files. Note that we are using numpydoc as of now, so for #56 some of the docstrings might need to be changed. If others have a suggestion on other doc styles we can definitely make a change though!

@andrewtavis
Copy link
Member Author

andrewtavis commented Feb 4, 2024

CC @wkyoshida :)

Another thing to consider is that it'd be good to set it up with a Edit on GitHub link or something like that in the top right rather than the View source (not too much value there I'd say). This can be a separate issue though if we want 😊

@andrewtavis
Copy link
Member Author

I would say in general a couple more links to GitHub in there would be good. Maybe something in the left sidebar as well?

@andrewtavis
Copy link
Member Author

andrewtavis commented Feb 4, 2024

Also of note, here's an awesome list for readthedocs for examples: github.com/readthedocs-examples/awesome-read-the-docs. I think that for this issue we can focus on finalizing getting all the function docstrings in here along with #56, and then we can make a few more issues for customizing it a bit with things like a logo in the sidebar, etc.

@andrewtavis
Copy link
Member Author

andrewtavis commented Feb 24, 2024

Very long day of work on this to get it ready for docs and the next steps for GSoC, but we're basically there 😊 One minor release and two patches to get it all cleaned up and the docs working in a day 🚀

Where we're at for the documentation can be seen at scribe-data.readthedocs.io. I did some basic organizing, and autodoc/automodule is working. We can now apply this over the rest of the project and then this issue will be finished :)

Of note is that I got rid of the conda environment and we're now using Python venv (docs have been updated). Was necessary to do a release so that tensorflow wouldn't needlessly be installed when we install Scribe-Data for the docs. To get the venv up and running we can do the following:

# In the root of the project:
python3 -m venv venv  # make an environment venv
pip install --upgrade pip  # make sure that pip is at the latest version
pip install -r requirements.txt  # install dependencies

If you're using VS Code, then it should prompt you to select this as the default environment. From there restart the terminal session in VS Code to then see that you're in the venv.

To get the docs up and running:

cd docs
make html

You can then open index.html within docs/build/html to check the local version of the documentation.

Note also that one of the changes that went through is that the baseline data files from Wikidata are removed once the formatted JSON file is finished.

Let's discuss all of this in the sync! 😊

@andrewtavis
Copy link
Member Author

Hey @shashank-iitbhu 👋 Do you want to send the autodoc/automodule calls to finalize the documentation and we can close this?

@andrewtavis
Copy link
Member Author

.. automodule:: scribe_data.utils
    :members:
    :private-members:

@shashank-iitbhu
Copy link
Contributor

Hey @shashank-iitbhu 👋 Do you want to send the autodoc/automodule calls to finalize the documentation and we can close this?

Looking into this!

@shashank-iitbhu
Copy link
Contributor

In conf.py the sys.path is this:

sys.path.insert(0, os.path.abspath(".."))

don't you think, it should be :

sys.path.insert(0, os.path.abspath("../../src"))

currently getting this error, when i do cd docs && make html :
Screenshot 2024-03-10 at 5 08 14 PM

After updating the path to ../../src
i was able to generate docs for all the functions in checkquery.py and utils.py.

Screenshot 2024-03-10 at 3 59 28 PM

@shashank-iitbhu
Copy link
Contributor

shashank-iitbhu commented Mar 10, 2024

Am I missing something? cc @andrewtavis

@andrewtavis
Copy link
Member Author

Closed via 18046e3 🥳 Definitely will need to be updated as we go, but this we finally have a baseline for the documentation for Scribe-Data! 🙌 Thanks all so much for your contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation feature New feature or request help wanted Extra attention is needed
Projects
Archived in project
Development

No branches or pull requests

3 participants