-
Notifications
You must be signed in to change notification settings - Fork 207
Add source root dir to python path in docs/conf.py #157
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
Conversation
conf.py imports the version from the local module, so it needs to have the
directory in the python path, otherwise it fails with:
$ sphinx-apidoc -f -e -o docs/api msal
Creating file docs/api/msal.application.rst.
Creating file docs/api/msal.authority.rst.
Creating file docs/api/msal.exceptions.rst.
Creating file docs/api/msal.mex.rst.
Creating file docs/api/msal.token_cache.rst.
Creating file docs/api/msal.wstrust_request.rst.
Creating file docs/api/msal.wstrust_response.rst.
Creating file docs/api/msal.rst.
Creating file docs/api/msal.oauth2cli.assertion.rst.
Creating file docs/api/msal.oauth2cli.authcode.rst.
Creating file docs/api/msal.oauth2cli.oauth2.rst.
Creating file docs/api/msal.oauth2cli.oidc.rst.
Creating file docs/api/msal.oauth2cli.rst.
Creating file docs/api/modules.rst.
$ make -C docs man
make: Entering directory '/home/bluca/git/microsoft-authentication-library-for-python/docs'
Running Sphinx v1.8.4
Configuration error:
There is a programmable error in your configuration file:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/sphinx/config.py", line 368, in eval_config_file
execfile_(filename, namespace)
File "/usr/lib/python3/dist-packages/sphinx/util/pycompat.py", line 150, in execfile_
exec_(code, _globals)
File "/home/bluca/git/microsoft-authentication-library-for-python/docs/conf.py", line 27, in <module>
from msal import __version__ as version
ModuleNotFoundError: No module named 'msal'
make: *** [Makefile:19: man] Error 2
|
Thanks for spending time on this, Luca! You probably also noticed that we have a hand-written We believe our hand-written API reference docs would be more organized than those blindly-generated api docs, because the latter one won't be smart enough to exclude internal helpers, hence resulting in a more-crowded, less-helpful doc. |
|
Sorry I'm not that familiar with sphinx - what's the command to use that existing index? |
|
Derived from sphinx's own doc, I ran this and, despite some warning, it seemed successful. PS: I am not that familiar with sphinx either. We just let our docs hosting service ReadTheDocs to do the heavy lifting. :) |
|
That gives me the same error: With the attached patch the error is fixed. The diff between the manpage generated by that command and the ones I pasted in the original post is just one line and very minor: |
|
Could that be a different behavior in sphinx itself? Would you mind upgrade your sphinx from 1.8.4 to its latest 2.4.1 and try again? |
|
I cannot, Debian only has up to 1.8.5. Also, I don't really see how it could work - it's trying to import a module without having it in the path. |
|
|
I am packaging this to be uploaded to Debian and Ubuntu: https://ftp-master.debian.org/new/microsoft-authentication-library-for-python_1.1.0-1.html |
|
Also, installing a different version on the system means the docs are built using that version, rather than the one in the repository. I do not believe that is what you want. |
|
To address your last comment, I believe it is solved on our docs building platform, because they do something equivalent to |
rayluo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Luca!
Note: Turns out we need this, when/if the current machine did not already have an equivalent of pip install -e . to install msal beforehand.
conf.py imports the version from the local module, so it needs to have the
directory in the python path, otherwise it fails with:
$ sphinx-apidoc -f -e -o docs/api msal
Creating file docs/api/msal.application.rst.
Creating file docs/api/msal.authority.rst.
Creating file docs/api/msal.exceptions.rst.
Creating file docs/api/msal.mex.rst.
Creating file docs/api/msal.token_cache.rst.
Creating file docs/api/msal.wstrust_request.rst.
Creating file docs/api/msal.wstrust_response.rst.
Creating file docs/api/msal.rst.
Creating file docs/api/msal.oauth2cli.assertion.rst.
Creating file docs/api/msal.oauth2cli.authcode.rst.
Creating file docs/api/msal.oauth2cli.oauth2.rst.
Creating file docs/api/msal.oauth2cli.oidc.rst.
Creating file docs/api/msal.oauth2cli.rst.
Creating file docs/api/modules.rst.
$ make -C docs man
make: Entering directory '/home/bluca/git/microsoft-authentication-library-for-python/docs'
Running Sphinx v1.8.4
Configuration error:
There is a programmable error in your configuration file:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/sphinx/config.py", line 368, in eval_config_file
execfile_(filename, namespace)
File "/usr/lib/python3/dist-packages/sphinx/util/pycompat.py", line 150, in execfile_
exec_(code, _globals)
File "/home/bluca/git/microsoft-authentication-library-for-python/docs/conf.py", line 27, in
from msal import version as version
ModuleNotFoundError: No module named 'msal'
make: *** [Makefile:19: man] Error 2