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

BuildEnvironment.warn_node is deprecated #101

Closed
denisrosset opened this issue Jan 8, 2020 · 7 comments
Closed

BuildEnvironment.warn_node is deprecated #101

denisrosset opened this issue Jan 8, 2020 · 7 comments

Comments

@denisrosset
Copy link
Contributor

Thus, instead of emitting a warning, Sphinx crashes hard when there is a problem with reference resolution. Full output below.

Running Sphinx v2.3.1
[autosummary] generating autosummary for: api/base.rst, api/groups.rst, api/index.rst, index.rst
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 4 source files that are out of date
updating environment: [new config] 4 added, 0 changed, 0 removed
reading sources... [100%] index                                                                                                                                    
WARNING: [sphinxcontrib-matlabdomain] Parsing failed in +replab.SedumiData. Check if valid MATLAB code.
WARNING: [sphinxcontrib-matlabdomain] Parsing failed in +replab.CommutantVar. Check if valid MATLAB code.
/home/denis/w/replab/sphinxdocs/_src/+replab:docstring of +replab.Monoid:3: WARNING: Unknown target name: "https://en.wikipedia.org/wiki/monoid".
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... WARNING: unsupported theme option 'globaltoc_depth' given
done
/home/denis/software/jupyter-env/lib/python3.6/site-packages/guzzle_sphinx_theme/guzzle_sphinx_theme/layout.html:198: RemovedInSphinx30Warning: To modify script_files in the theme is deprecated. Please insert a <script> tag directly in your theme instead.
writing output... [ 50%] api/groups                                                                                                                                
Exception occurred:
  File "/home/denis/software/jupyter-env/lib/python3.6/site-packages/sphinxcontrib/matlab.py", line 735, in resolve_xref
    env.warn_node(
AttributeError: 'BuildEnvironment' object has no attribute 'warn_node'
@joeced
Copy link
Collaborator

joeced commented Jan 8, 2020

Could you provide some minimal example that has this error?

@denisrosset
Copy link
Contributor Author

denisrosset commented Jan 8, 2020

There it is:

https://github.com/denisrosset/sphinxcontrib-matlabdomain-report

Note that I'm doing weird things with references (autogenerating references for inherited members), so that's probably what triggers the original warning. I'm fine with that (and found that not using the dot prefix solves the problem).

The triggered warning is quite fragile, and some attempts to minimize the report further were unsuccessful, thus I'm leaving the code as it is.

The bug report concerns the way the warning is triggered by the Matlab domain, by calling warn_node that has probably been deprecated. I was unable to find which Sphinx version deprecated that method though.

@joeced
Copy link
Collaborator

joeced commented Jan 16, 2020

Thanks for the link. I have been busy at home and at work, and had no time to look into this yet. But I'll try to squeeze it in.

@denisrosset
Copy link
Contributor Author

No problem, it's sitting there and not going away

@joeced
Copy link
Collaborator

joeced commented Oct 10, 2020

Finally, had some time to look at this. I can confirm, that the it indeed triggers this warning. I found the commit where warn_node was removed: sphinx-doc/sphinx@02afc35 - and as you found, no alternative. I'll try to figure out how to warn.

Edit: Found a fix. @denisrosset would it be okay to include part of the repo you created as a test?

@denisrosset
Copy link
Contributor Author

Absolutely! please take anything you want. If you want me to run some tests too; happy to do so.

@joeced
Copy link
Collaborator

joeced commented Jan 6, 2021

I just looked at it again - and it seems I can replace warn_node with a simple logger warning. Would that be ok for your use-case?

joeced added a commit that referenced this issue Jun 15, 2021
- Added test code from https://github.com/denisrosset/sphinxcontrib-matlabdomain-report
- Changed deprecated warning to logger warning.
joeced added a commit that referenced this issue Jun 15, 2021
* Updated to version 0.12.0.
* Only Sphinx >= 4.0.0 is now supported.
* Only Python >= 3.6 is supported.
* Fixed numerous warnings due to deprecated Sphinx API.
* Fixed issue #101
* CI now tests on Python 3.6, 3.7, 3.8 and 3.9.
@joeced joeced closed this as completed Jun 15, 2021
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

2 participants