Skip to content

CI: Format rst code blocks with blacken-docs #57401

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
wants to merge 3 commits into from

Conversation

tqa236
Copy link
Contributor

@tqa236 tqa236 commented Feb 13, 2024

@tqa236 tqa236 requested a review from noatamir as a code owner February 13, 2024 13:49
@simonjayhawkins simonjayhawkins added the Code Style Code style, linting, code_checks label Feb 13, 2024
@tqa236 tqa236 marked this pull request as draft February 13, 2024 14:11
@datapythonista
Copy link
Member

What's the plan with this @tqa236? Are the problems in the CI a blocker to move forward with this?

@datapythonista datapythonista added Docs CI Continuous Integration labels Mar 6, 2024
@datapythonista datapythonista changed the title Format rst CI: Format rst Mar 6, 2024
@tqa236
Copy link
Contributor Author

tqa236 commented Mar 6, 2024

hi @datapythonista, this problem is not related to the recent broken CI, although the broken CI indeed doesn't help testing or exploring.

The exact issue that prevents us from having a green CI is just the number of new lines in some code blocks in the doc where black enforces the new lines but ipython raises a warning there, which are treated as errors per our configuration. This warning doesn't affect the build, as the rendered doc still looks correct.

The approach I'm exploring now is a way to disable this warning by passing ipython_warning_is_error=False to silent this warning while still keeping other sphinx warning.

I raised the issue here and here as well, but any quick change seems unlikely.

If you can point me to where I can pass jupyter or sphinx config to the build, it would be a great help.

@tqa236 tqa236 marked this pull request as ready for review March 6, 2024 16:10
@tqa236 tqa236 marked this pull request as draft March 6, 2024 16:11
@datapythonista datapythonista changed the title CI: Format rst CI: Format rst code blocks with blacken-docs Mar 6, 2024
@datapythonista
Copy link
Member

Thanks for the update @tqa236.

I can't find the warnings in the doc build, are they still happening?

Configuration changes should be placed in doc/source/conf.py, I see an nbsphinx option to control the warnings: https://nbsphinx.readthedocs.io/en/0.9.3/configuration.html#suppress_warnings

I don't fully understand why ipython/nbsphinx should complain about blank lines, they shouldn't validate the style or format that I know, just execute the code. I can have a look if you can point me to the warnings that are making the CI fail, I only see an error I think I saw in other PRs about the section underlines.

CC @MarcoGorelli in case you have any opinion here.

@tqa236
Copy link
Contributor Author

tqa236 commented Mar 6, 2024

thanks for pointing me to the conf file, @datapythonista. I'm able to pass the IPython config to the sphinx build now.

Unfortunately, my approach doesn't work yet, as a warning is still raised, and sphinx will fail the build because of that.

I'll need to think of another solution.

@tqa236
Copy link
Contributor Author

tqa236 commented Mar 12, 2024

closed as I don't know how to proceed yet.

@tqa236 tqa236 closed this Mar 12, 2024
@tqa236 tqa236 deleted the format-rst branch March 12, 2024 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Continuous Integration Code Style Code style, linting, code_checks Docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

STYLE replace flake8-rst with something maintained
3 participants