Skip to content

CI: Fail build on "UserWarning: Code input with no code at..." #41410

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

Closed
rhshadrach opened this issue May 10, 2021 · 6 comments
Closed

CI: Fail build on "UserWarning: Code input with no code at..." #41410

rhshadrach opened this issue May 10, 2021 · 6 comments
Labels
CI Continuous Integration Docs

Comments

@rhshadrach
Copy link
Member

Blank lines in ipython blocks cause the warning "UserWarning: Code input with no code at..." to be emitted when building the docs. #41400 removed the blank lines so there are currently no warnings, but they will likely reappear, specially since double blank lines around classes/functions looks correct. Should we fail the doc build on such a warning (not sure why that doesn't already happen) or enforce this through style checks?

@rhshadrach rhshadrach added Docs CI Continuous Integration labels May 10, 2021
@jorisvandenbossche
Copy link
Member

I think that would indeed be good to fail the doc build on such a warning.

not sure why that doesn't already happen

The doc build is configured to fail for any Sphinx warning, but this is a plain python warning from the ipyhon directive (https://github.com/ipython/ipython/blob/0e4d6390b2174fb1b352a082b72ad387ae696e87/IPython/sphinxext/ipython_directive.py#L1016-L1023)

A relatively easy fix might actually be to fix this upstream and to make that warnings.warn(..) into a sphinx logger.warning(..) so we can use the standard sphinx machinery to catch this.
Somewhat related issue about having exceptions turned into sphinx logger's warnings/errors: ipython/ipython#11547

@rhshadrach
Copy link
Member Author

rhshadrach commented May 14, 2021

Thanks @jorisvandenbossche! I hope to find some time to follow up on this and put in a PR to ipython in a few weeks.

@rhshadrach
Copy link
Member Author

ipython/ipython#13030 has been merged, to be included in 7.26. Will test after 7.26 is released and can then close this issue.

@MrMino
Copy link

MrMino commented Aug 1, 2021

@rhshadrach Update: 7.26 was released today.

@rhshadrach
Copy link
Member Author

Thanks @MrMino! Confirmed the CI fails when warnings are present in #42858.

@jorisvandenbossche
Copy link
Member

Thanks @rhshadrach for fixing this on the IPython side!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Continuous Integration Docs
Projects
None yet
Development

No branches or pull requests

3 participants