callowayproject/bump-my-version

EncodingWarning

Closed this issue · 0 comments

  • bump-my-version version: 0.10
  • Python version: 3.11
  • Operating System: macOS

Description

If you run bump-my-version in an environment with PYTHONWARNDEFAULTENCODING set, it produces warnings (I have it set in a tox.ini). It would be nice if these three locations could define an encoding to avoid the warning. (And I expect the tomlkit one is wrong as is - TOML is always in utf-8, while Python < 3.14 will use "native").

What I Did

Warning when running with the above setting:

/Users/henryschreiner/git/software/build/.tox/bump/lib/python3.11/site-packages/bumpversion/config.py:272: EncodingWarning: 'encoding' argument not specified
  (cfg_file for cfg_file in search_paths if cfg_file.exists() and "bumpversion]" in cfg_file.read_text()),
/Users/henryschreiner/git/software/build/.tox/bump/lib/python3.11/site-packages/bumpversion/config.py:380: EncodingWarning: 'encoding' argument not specified
  toml_data = tomlkit.parse(file_path.read_text()).unwrap()
/Users/henryschreiner/git/software/build/.tox/bump/lib/python3.11/site-packages/bumpversion/scm.py:244: EncodingWarning: 'encoding' argument not specified.
  result = subprocess.run(git_cmd, text=True, check=True, capture_output=True)  # noqa: S603