-
Notifications
You must be signed in to change notification settings - Fork 116
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
Sphinx-Action can't find target Python modules when custom sys.path(s) are specified in conf.py #17
Comments
Hey, that's really weird. Not sure why it's happening. Could you show the logs for sphinx-action for when it generates those empty documentation files? Alternatively, you can also just push your project to Github so I can try recreating it myself (I tried looking through you repos but couldn't find it). |
I initially ran into the same issue, but was able to resolve (and responded on SO). If you want to compare notes, here's the link to my repo .. it's very much work in progress, but the GitHub actions work. PS: There are some differences here as I use |
@chamaoskurumi Is the workflow running, passing, and not generating docs, or is the workflow failing? Can you share a link to your GitHub Actions run? |
Sorry @adam-grant-hendry , I cannot reproduce the error now as I don't have access anymore the code I used back then. Unfortunately I also can't remember if the workflow passed or not, but I'm pretty sure it didn't. |
@chamaoskurumi No worries. Thanks for replying back! I agree with @ischoegl that your package was most likely not importable, which can cause this to happen. The
This can be done in one of two ways:
I generally don't recommend 2, but if you choose it, you can safeguard against this from happening again by using from importlib import import_module
package_name = 'my_package' # Replace with your package name
try:
import_module(package_name)
except ImportError as err:
raise ImportError(f'Package {package_name} could not be imported.') It's also generally considered best practice nowadays to use the The second recommendation in your SO post to use Ultimately, the issue comes down to your package being importable, so I recommend 1 like @ischoegl did. It's much simpler and cleaner all around. Just do |
@ammaraskar @chamaoskurumi Can this issue be closed? |
Tl;dr
When I create a sphinx doc locally it builds as expected, but sphinx-action creates an empty doc. It must have to do with the sphinx-action not finding the target python modules as specified in
conf.py
.Any ideas to configure the sphinx-action or
conf.py
correctly?Expected Sphinx Doc
When I build the sphinx doc locally on my machine via
cd docs/ && make html
the resulting html looks as expectedEmpty Sphinx Doc generated by sphinx-action
My
.github/workflows/sphinx_action.yml
includesand generates an empty skeleton of a Sphinx Doc
Project Setup
Project Structure
conf.py
ConfigurationMy
docs/conf.py
looks as follows. (Mind that I added three entries to thesys.path
manually in order to make Sphinx find all python modules.)Pipfile
Note: I asked the same question on SO.
The text was updated successfully, but these errors were encountered: