From 6c856b6db40300de2ba0583bbd092b25d01b0004 Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Mon, 27 Jan 2025 11:36:01 -0600 Subject: [PATCH 1/2] Fixes #284. Add UTF-8 encoding to subprocess.run in run_command Explicitly set the encoding to "utf-8" in the subprocess.run call to ensure consistent handling of command output. This prevents potential encoding-related issues when processing command results. --- bumpversion/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bumpversion/utils.py b/bumpversion/utils.py index 58c84fd1..27b23510 100644 --- a/bumpversion/utils.py +++ b/bumpversion/utils.py @@ -124,7 +124,9 @@ def format_and_raise_error(exc: Union[TypeError, subprocess.CalledProcessError]) def run_command(command: list, env: Optional[dict] = None) -> CompletedProcess: """Run a shell command and return its output.""" - result = subprocess.run(command, text=True, check=True, capture_output=True, env=env) # NOQA: S603 + result = subprocess.run( # NOQA: S603 + command, text=True, check=True, capture_output=True, env=env, encoding="utf-8" + ) result.check_returncode() return result From cd2b193412b87ef47c3b9129b527eaa826429270 Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Mon, 27 Jan 2025 13:21:21 -0600 Subject: [PATCH 2/2] Fixing issues with 3.9 compatibility --- .github/workflows/test.yaml | 2 +- bumpversion/utils.py | 2 +- pyproject.toml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 486557f1..e6dede33 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,4 +1,4 @@ -name: CI +name: Test on: pull_request: diff --git a/bumpversion/utils.py b/bumpversion/utils.py index 27b23510..0341df47 100644 --- a/bumpversion/utils.py +++ b/bumpversion/utils.py @@ -131,7 +131,7 @@ def run_command(command: list, env: Optional[dict] = None) -> CompletedProcess: return result -def is_subpath(parent: Path | str, path: Path | str) -> bool: +def is_subpath(parent: Union[Path, str], path: Union[Path, str]) -> bool: """Return whether a path is inside the parent.""" normalized_parent = Path(parent) normalized_path = Path(path) diff --git a/pyproject.toml b/pyproject.toml index 20d00b13..149f276b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,18 +16,18 @@ classifiers = [ "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Build Tools", "Topic :: Software Development :: Version Control", "Topic :: System :: Software Distribution", ] readme = "README.md" -requires-python = ">=3.8" +requires-python = ">=3.9" license = { file = "LICENSE" } keywords = ["bumpversion", "version", "release"] dynamic = ["version"]