Repository: commitizen-tools/commitizen

Issue:
Support new charset-normalizer v3
### Description

The package `charset-normalizer` has released the v3. The dependency for this project is `<3.0.0,>=2.1.0`

### Possible Solution

Add the support for new version of `charset-normalizer` and add it to the supported versions

### Additional context

_No response_

### Additional context

https://github.com/Ousret/charset_normalizer/releases
The 3.0.0 released in Oct, version 3.0.1 released in Nov.

Comments:

Patch:
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index aa1d625d..0aeaa4d0 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -14,7 +14,7 @@ repos:
       - id: no-commit-to-branch
 
   - repo: https://github.com/commitizen-tools/commitizen
-    rev: v2.42.0 # automatically updated by Commitizen
+    rev: v2.42.1 # automatically updated by Commitizen
     hooks:
       - id: commitizen
       - id: commitizen-branch
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cbc4c913..abfa1216 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,10 @@
 
+## v2.42.1 (2023-02-25)
+
+### Fix
+
+- **bump**: fixed environment variables in bump hooks
+
 ## v2.42.0 (2023-02-11)
 
 ### Feat
diff --git a/commitizen/__version__.py b/commitizen/__version__.py
index 6e61a2d0..03e94c21 100644
--- a/commitizen/__version__.py
+++ b/commitizen/__version__.py
@@ -1,1 +1,1 @@
-__version__ = "2.42.0"
+__version__ = "2.42.1"
diff --git a/commitizen/hooks.py b/commitizen/hooks.py
index f5efb807..f5505d0e 100644
--- a/commitizen/hooks.py
+++ b/commitizen/hooks.py
@@ -1,5 +1,7 @@
 from __future__ import annotations
 
+import os
+
 from commitizen import cmd, out
 from commitizen.exceptions import RunHookError
 
@@ -25,7 +27,7 @@ def run(hooks, _env_prefix="CZ_", **env):
 def _format_env(prefix: str, env: dict[str, str]) -> dict[str, str]:
     """_format_env() prefixes all given environment variables with the given
     prefix so it can be passed directly to cmd.run()."""
-    penv = dict()
+    penv = dict(os.environ)
     for name, value in env.items():
         name = prefix + name.upper()
         value = str(value) if value is not None else ""
diff --git a/pyproject.toml b/pyproject.toml
index 03007ee6..d70c2a1e 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,5 +1,5 @@
 [tool.commitizen]
-version = "2.42.0"
+version = "2.42.1"
 tag_format = "v$version"
 version_files = [
   "pyproject.toml:version",
@@ -30,7 +30,7 @@ exclude = '''
 
 [tool.poetry]
 name = "commitizen"
-version = "2.42.0"
+version = "2.42.1"
 description = "Python commitizen client tool"
 authors = ["Santiago Fraire <santiwilly@gmail.com>"]
 license = "MIT"
@@ -70,7 +70,7 @@ jinja2 = ">=2.10.3"
 pyyaml = ">=3.08"
 argcomplete = ">=1.12.1,<2.1"
 typing-extensions = "^4.0.1"
-charset-normalizer = "^2.1.0"
+charset-normalizer = ">=2.1.0,<3.1"
 
 [tool.poetry.dev-dependencies]
 ipython = "^7.2"


Test patch:
diff --git a/tests/test_bump_hooks.py b/tests/test_bump_hooks.py
index af1f2a2d..70ed7fe0 100644
--- a/tests/test_bump_hooks.py
+++ b/tests/test_bump_hooks.py
@@ -1,3 +1,4 @@
+import os
 from unittest.mock import call
 
 import pytest
@@ -17,7 +18,10 @@ def test_run(mocker: MockFixture):
     hooks.run(bump_hooks)
 
     cmd_run_mock.assert_has_calls(
-        [call("pre_bump_hook", env={}), call("pre_bump_hook_1", env={})]
+        [
+            call("pre_bump_hook", env=dict(os.environ)),
+            call("pre_bump_hook_1", env=dict(os.environ)),
+        ]
     )