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.

Discussion:
codecov[bot]: # [Codecov](https://codecov.io/gh/commitizen-tools/commitizen/pull/669?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) Report
Base: **97.92**% // Head: **98.08**% // Increases project coverage by **`+0.15%`** :tada:
> Coverage data is based on head [(`940f016`)](https://codecov.io/gh/commitizen-tools/commitizen/pull/669?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) compared to base [(`619e2d2`)](https://codecov.io/gh/commitizen-tools/commitizen/commit/619e2d282c5e8794c53eacde938aa51f06d0c9e2?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None).
> Patch coverage: 91.74% of modified lines in pull request are covered.

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##           master     #669      +/-   ##
==========================================
+ Coverage   97.92%   98.08%   +0.15%     
==========================================
  Files          35       40       +5     
  Lines        1252     1719     +467     
==========================================
+ Hits         1226     1686     +460     
- Misses         26       33       +7     
```

| Flag | Coverage Δ | |
|---|---|---|
| unittests | `98.08% <91.74%> (+0.15%)` | :arrow_up: |

Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#carryforward-flags-in-the-pull-request-comment) to find out more.

| [Impacted Files](https://codecov.io/gh/commitizen-tools/commitizen/pull/669?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | Coverage Δ | |
|---|---|---|
| [commitizen/cli.py](https://codecov.io/gh/commitizen-tools/commitizen/pull/669?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-Y29tbWl0aXplbi9jbGkucHk=) | `93.93% <ø> (ø)` | |
| [commitizen/commands/init.py](https://codecov.io/gh/commitizen-tools/commitizen/pull/669?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-Y29tbWl0aXplbi9jb21tYW5kcy9pbml0LnB5) | `87.93% <84.00%> (-3.74%)` | :arrow_down: |
| [commitizen/hooks.py](https://codecov.io/gh/commitizen-tools/commitizen/pull/669?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-Y29tbWl0aXplbi9ob29rcy5weQ==) | `95.45% <95.45%> (ø)` | |
| [commitizen/\_\_version\_\_.py](https://codecov.io/gh/commitizen-tools/commitizen/pull/669?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-Y29tbWl0aXplbi9fX3ZlcnNpb25fXy5weQ==) | `100.00% <100.00%> (ø)` | |
| [commitizen/bump.py](https://codecov.io/gh/commitizen-tools/commitizen/pull/669?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-Y29tbWl0aXplbi9idW1wLnB5) | `100.00% <100.00%> (ø)` | |
| [commitizen/cmd.py](https://codecov.io/gh/commitizen-tools/commitizen/pull/669?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-Y29tbWl0aXplbi9jbWQucHk=) | `100.00% <100.00%> (ø)` | |
| [commitizen/commands/bump.py](https://codecov.io/gh/commitizen-tools/commitizen/pull/669?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-Y29tbWl0aXplbi9jb21tYW5kcy9idW1wLnB5) | `97.46% <100.00%> (+0.15%)` | :arrow_up: |
| [commitizen/commands/check.py](https://codecov.io/gh/commitizen-tools/commitizen/pull/669?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-Y29tbWl0aXplbi9jb21tYW5kcy9jaGVjay5weQ==) | `100.00% <100.00%> (ø)` | |
| [commitizen/config/yaml\_config.py](https://codecov.io/gh/commitizen-tools/commitizen/pull/669?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-Y29tbWl0aXplbi9jb25maWcveWFtbF9jb25maWcucHk=) | `100.00% <100.00%> (ø)` | |
| [commitizen/defaults.py](https://codecov.io/gh/commitizen-tools/commitizen/pull/669?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-Y29tbWl0aXplbi9kZWZhdWx0cy5weQ==) | `100.00% <100.00%> (ø)` | |
| ... and [5 more](https://codecov.io/gh/commitizen-tools/commitizen/pull/669?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | |

Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None)

</details>

[:umbrella: View full report at Codecov](https://codecov.io/gh/commitizen-tools/commitizen/pull/669?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None).   
:loudspeaker: Do you have feedback about the report comment? [Let us know in this issue](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None).


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)),
+        ]
     )