sphinx-contrib / matlabdomain

A Sphinx extension for documenting Matlab code
Other
64 stars 45 forks source link

Extension error when deplyoing with GitHub pages #233

Closed piepustina closed 7 months ago

piepustina commented 8 months ago

I am trying to deploy a sphinx project on GitHub through this tutorial: https://www.sphinx-doc.org/en/master/tutorial/deploying.html

While building the sphinx project I am getting the following output with an error related to sphinxcontrib.matlab extension:

Running Sphinx v7.2.6 making output directory... done [sphinxcontrib-matlabdomain] matlab_short_links=True, forcing matlab_keep_package_prefix=False. WARNING: html_static_path entry '_static' does not exist checking bibtex cache... out of date parsing bibtex file /home/runner/work/Jelly/Jelly/docs/source/references.bib... parsed 2 entries [autosummary] generating autosummary for: GVS/pac2d.rst, GVS/pac3d.rst, GVS/pcc2d.rst, GVS/pcc2dElongation.rst, GVS/pcc3d.rst, GVS/pgc3d.rst, VGVS/vpcc2d.rst, api.rst, body.rst, bodytree.rst, fixedjoint.rst, gvsbody.rst, index.rst, joint.rst, rigidbody.rst, rotationaljoint.rst, usage.rst, vgvsbody.rst

Extension error (sphinxcontrib.matlab): Handler <function analyze at 0x7f4877d17400> for event 'builder-inited' threw an exception (exception: 'NoneType' object has no attribute 'safe_getmembers') Error: Process completed with exit code 2.

I can successfully build the project on my laptop without any warning and using the same version of shpinx and python.

joeced commented 8 months ago

Hi

Do you have something more you can share, like the repo maybe?

Are you you using the same Python environment in both situations?

piepustina commented 7 months ago

Hi, thank you for the quick reply.

I created an exact copy of the repository at the following link: https://github.com/piepustina/JellyTest.git

I realized that the "matlab_src_dir" was set to an absolute path (of my laptop). I changed "matlab_src_dir" to its relative path with respect to the sphinx "source" directory. Now, the building process starts, but I get the following error:

Exception occurred: File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/sphinxcontrib/mat_types.py", line 1777, in for_module raise err sphinxcontrib.mat_types.MatcodeError: error importing 'classes' The full traceback has been saved in /tmp/sphinx-err-xbsdjj4j.log, if you want to report the issue to the developers. Please also report this if it was a user error, so that a better error message can be provided next time. A bug report can be filed in the tracker at https://github.com/sphinx-doc/sphinx/issues. Thanks! reading sources... [ 6%] GVS/pac2d

On my laptop I am using Python 3.10 and also in the GitHub action under ".github/workflows/sphinx.yml".

joeced commented 7 months ago

Allowing relative paths is a very new feature, there might be some cases that haven't been tested too well.

In conf.py try to replace

matlab_src_dir = "../src"

with

thisdir = os.path.dirname(__file__)
matlab_src_dir = os.path.abspath(os.path.join(thisdir, "..", "..", "src"))
piepustina commented 7 months ago

Hi joeced, this solved the issue, thank you!