diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ff65aaeca1..8a98dcef9e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,7 +12,7 @@ repos: - id: no-commit-to-branch - repo: https://github.com/commitizen-tools/commitizen - rev: v2.29.3 # automatically updated by Commitizen + rev: v2.29.4 # automatically updated by Commitizen hooks: - id: commitizen stages: [commit-msg] diff --git a/CHANGELOG.md b/CHANGELOG.md index 4305887cf2..764601f996 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,10 @@ +## v2.29.4 (2022-08-05) + +### Refactor + +- **tool**: use charset_normalizer instead of chardet + ## v2.29.3 (2022-08-02) ### Refactor diff --git a/commitizen/__version__.py b/commitizen/__version__.py index f99856f5d7..b13db77634 100644 --- a/commitizen/__version__.py +++ b/commitizen/__version__.py @@ -1 +1 @@ -__version__ = "2.29.3" +__version__ = "2.29.4" diff --git a/commitizen/cmd.py b/commitizen/cmd.py index f65f5c8e76..7f4efb6ad2 100644 --- a/commitizen/cmd.py +++ b/commitizen/cmd.py @@ -1,7 +1,7 @@ import subprocess from typing import NamedTuple -import chardet +from charset_normalizer import from_bytes class Command(NamedTuple): @@ -23,8 +23,8 @@ def run(cmd: str) -> Command: stdout, stderr = process.communicate() return_code = process.returncode return Command( - stdout.decode(chardet.detect(stdout)["encoding"] or "utf-8"), - stderr.decode(chardet.detect(stderr)["encoding"] or "utf-8"), + str(from_bytes(stdout).best()), + str(from_bytes(stderr).best()), stdout, stderr, return_code, diff --git a/pyproject.toml b/pyproject.toml index 886c3e6a74..ba93878de3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [tool.commitizen] -version = "2.29.3" +version = "2.29.4" tag_format = "v$version" version_files = [ "pyproject.toml:version", @@ -30,7 +30,7 @@ exclude = ''' [tool.poetry] name = "commitizen" -version = "2.29.3" +version = "2.29.4" description = "Python commitizen client tool" authors = ["Santiago Fraire "] license = "MIT" @@ -56,7 +56,7 @@ jinja2 = ">=2.10.3" pyyaml = ">=3.08" argcomplete = "^1.12.1" typing-extensions = "^4.0.1" -chardet = "^5.0.0" +charset-normalizer = "^2.1.0" [tool.poetry.dev-dependencies] ipython = "^7.2" @@ -82,7 +82,6 @@ mkdocs = "^1.0" mkdocs-material = "^4.1" pydocstyle = "^5.0.2" pytest-xdist = "^2.5.0" -types-chardet = "^5.0.2" [tool.poetry.scripts] cz = "commitizen.cli:main"