python-package-guide icon indicating copy to clipboard operation
python-package-guide copied to clipboard

Treat warnings as errors when building in CI

Open sneakers-the-rat opened this issue 7 months ago • 2 comments

I think it's probably a good idea to treat warnings as errors to avoid simple mistakes - e.g. currently there is an admonition that uses an invalid color parameter: https://github.com/pyOpenSci/python-package-guide/blob/c4877898915d24b6be60d35f76a2b67c8311fdc8/tutorials/publish-pypi.md?plain=1#L215

and it's shown in CI: https://github.com/pyOpenSci/python-package-guide/actions/runs/15569974496/job/43843279611#step:10:80

but the build passes.

I think we should add the -W flag to the TEST_PARAMETERS so that would appear as an action failure in CI and prompt us to fix those before merging. This particular warning is not a huge deal, but this would also guard against invalid internal links and a variety of common low-grade problems that don't crash the build but either don't do what they should be doing or cause the document to not be rendered as expected

sneakers-the-rat avatar Jun 14 '25 01:06 sneakers-the-rat

I am OK with this! We could consider a workflow that if CI fails and it's a external contribution that didn't actually trigger that failure, we could then simply open an issue to make the fix.

lwasser avatar Jun 17 '25 14:06 lwasser

not sure what you mean here, can you give an example?

these warnings happen during the build process and thus should be intrinsic to the document and so should always have been caused by the changes in the PR (not e.g. in something like the link checker where failures can be dependent on some external site being unavailable, which would not have been caused by the PR).

sneakers-the-rat avatar Jun 18 '25 21:06 sneakers-the-rat