Vital-Fernandez / lime

Line Measuring library in python
Other
14 stars 6 forks source link

API documentation not updating/showing on readthedocs #1

Closed Vital-Fernandez closed 2 years ago

Vital-Fernandez commented 2 years ago

The documentation compiles locally with errors locally (it does not update the docstrings) but it does not show up on readthedocs.

@astrojuanlu pointed out the lime import fails online:

WARNING: autodoc: failed to import function 'io.load_cfg' from module 'lime'; the following exception was raised: No module named 'lime'

astrojuanlu commented 2 years ago

Thanks for the ping @Vital-Fernandez ! Build link: https://readthedocs.org/projects/lime-stable/builds/15818775/

Usually the solution is adding this to the .readthedocs.yaml file:

python:
  install:
    - method: pip
      path: .

Let me know if that works!

Vital-Fernandez commented 2 years ago

Thank you very much @astrojuanlu for the suggestion.

I have those lines on the .yaml file.

I do, however, wonder if the file is being read during the compilation: The fail_on_warning option should block the building in this case and in the build link it is suggesting to get "Configure your documentation builds! Adding a .readthedocs.yaml"

Do I need to specify the .readthedocs.yaml location?

Edit: I am thinking that even though the library is called lime, the pip index is lime-stable. Maybe that is the reason pip cannot install the library?

astrojuanlu commented 2 years ago

Damn, I replied too fast 😅 sorry!

Indeed, the configuration is not being read apparently: you set Python 3.8, but 3.7 is being used. I'll give this a closer look tomorrow.

astrojuanlu commented 2 years ago

...the .readthedocs.yaml file has a leading space in the filename, and that's why it's not picked up! (Thanks @humitos for discovering it)

Vital-Fernandez commented 2 years ago

Thank you very much @astrojuanlu and @humitos!! I removed the space and the build started to fail at the autodoc because of the missing packages :).

I added the following lines (not sure if this is the right way to do it) to the conf.py:

import sys  
import os  
sys.path.append(os.path.join(os.path.abspath(os.pardir)))  
autodoc_mock_imports = ['lmfit', 'scipy', 'specutils', 'pylatex']

And now the API shows up :)

astrojuanlu commented 2 years ago

It's one way of doing it - but instead, you can declare those packages as dependencies of lime in your setup.cfg, and then they will get installed along with your own code. With that, you shouldn't need the sys.path.append nor the autodoc_mock_imports. Try it out, and let us know if you still see problems :)

Vital-Fernandez commented 2 years ago

Thank you very much , I have done that (not in the setup.cfg though but in the setup.py, I am still not sure how to parse lists from the configuration file but it is something on my TODO list)

Thanks again this is my first issue and it was a very good experience :heart_eyes:

I am closing now...