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

python documentation on read-the-docs seems to be broken #646

Open
uishon opened this issue May 1, 2021 · 3 comments
Open

python documentation on read-the-docs seems to be broken #646

uishon opened this issue May 1, 2021 · 3 comments

Comments

@uishon
Copy link

uishon commented May 1, 2021

Following this link and getting a one page doc with titles only. Tried PDF version and got the same. Any idea?
sefaria-python-read-the-docs

@uishon
Copy link
Author

uishon commented May 6, 2021

Tried building the docs locally on my machine. Got them created but with these errors:

WARNING: autodoc: failed to import class 'model.text.Library' from module 'sefaria'; the following exception was raised:
Traceback (most recent call last):
  File "/home/uri/.virtualenvs/sefaria/lib/python3.8/site-packages/sphinx/ext/autodoc/importer.py", line 71, in import_module
    return importlib.import_module(modname)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/uri/git/Sefaria-Project/sefaria/model/__init__.py", line 52, in <module>
    library._build_index_maps()
  File "/home/uri/git/Sefaria-Project/sefaria/model/text.py", line 4514, in _build_index_maps
    self._index_map = {i.title: i for i in IndexSet() if i.nodes}
  File "/home/uri/git/Sefaria-Project/sefaria/model/abstract.py", line 314, in __init__
    self.raw_records = getattr(db, self.recordClass.collection).find(self.query, proj)
AttributeError: 'builtin_function_or_method' object has no attribute 'find'

/home/uri/git/Sefaria-Project/sefaria/model/text.py:docstring of sefaria.model.text.Ref.is_segment_level:3: WARNING: Unexpected indentation.
WARNING: autodoc: failed to import class 'CommentaryIndex' from module 'sefaria.model.text'; the following exception was raised:
Traceback (most recent call last):
  File "/home/uri/.virtualenvs/sefaria/lib/python3.8/site-packages/sphinx/util/inspect.py", line 403, in safe_getattr
    return getattr(obj, name, *defargs)
AttributeError: module 'sefaria.model.text' has no attribute 'CommentaryIndex'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/uri/.virtualenvs/sefaria/lib/python3.8/site-packages/sphinx/ext/autodoc/importer.py", line 111, in import_object
    obj = attrgetter(obj, mangled_name)
  File "/home/uri/.virtualenvs/sefaria/lib/python3.8/site-packages/sphinx/ext/autodoc/__init__.py", line 320, in get_attr
    return autodoc_attrgetter(self.env.app, obj, name, *defargs)
  File "/home/uri/.virtualenvs/sefaria/lib/python3.8/site-packages/sphinx/ext/autodoc/__init__.py", line 2604, in autodoc_attrgetter
    return safe_getattr(obj, name, *defargs)
  File "/home/uri/.virtualenvs/sefaria/lib/python3.8/site-packages/sphinx/util/inspect.py", line 419, in safe_getattr
    raise AttributeError(name) from exc
AttributeError: CommentaryIndex

Could that be the reason for the docs not being published on readthedocs?

As for the actual errors, well, there are 3 of them. I believe the second is a pure indentation issue. Managed to fix it and will create a respective pull request. The third seems to be the result of a reference to CommentaryIndex which seems to not exist anymore. Not sure about the root cause of the first one.

@nsantacruz
Copy link
Contributor

I've pushed this commit to remove mention of CommentaryIndex: a4c2e8b

@EliezerIsrael what do you think about fixing our ReadTheDocs page?

@Stoops-ML
Copy link

The error AttributeError: 'builtin_function_or_method' object has no attribute 'find' is because the getattr(db, self.recordClass.collection) should be wrapped in a str():

self.raw_records = str(getattr(db, self.recordClass.collection)).find(self.query, proj)

However, this raises a new error from Sphinx: TypeError: must be str, not dict. This error occurs because self.query appears to be a dictionary: self.query = query or {}, and you can't perform find on a dictionary.

I haven't spent very long with this repo yet. What type should self.query have?

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

No branches or pull requests

3 participants