twisted / towncrier

Manage the release notes for your project.
https://towncrier.readthedocs.io
MIT License
755 stars 107 forks source link

EncodingWarning when building #561

Closed jaraco closed 2 months ago

jaraco commented 7 months ago

While building using towncrier with PYTHONWARNDEFAULTENCODING=1, I see this warning:

/Users/jaraco/code/jaraco/jaraco.functools/.tox/finalize/lib/python3.11/site-packages/towncrier/build.py:169: EncodingWarning: 'encoding' argument not specified
  resources.files(config.template[0]).joinpath(config.template[1]).read_text()

One needs to explicitly pass encoding='utf-8' to .read_text() to avoid these warnings. See PEP 597 for details.

adiroiban commented 7 months ago

Thanks. Good call.

I think that trial is missing a helper to catch generic warnings... but maybe we can have a quick hack and run our CI with the warnings enabled and just fail somehow is a warning is raised.

But event a PR with just the explicit encoding, and without any extra warning detection, is good enough.

Happy to review a PR.