Skip to content

Commit a032fa4

Browse files
committed
refactor(templates): move changelog_template from cz to templates
1 parent 2b15a1b commit a032fa4

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

commitizen/commands/changelog.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
import re
2+
import pkg_resources
23
from collections import OrderedDict
34

45
from jinja2 import Template
56

6-
from commitizen import factory, out, git, cz
7+
from commitizen import factory, out, git
78
from commitizen.config import BaseConfig
89
from commitizen.error_codes import NO_COMMITS_FOUND, NO_PATTERN_MAP
910

10-
try:
11-
import importlib.resources as pkg_resources
12-
except ImportError:
13-
# Try backported to PY<37 `importlib_resources`.
14-
import importlib_resources as pkg_resources
15-
1611

1712
class Changelog:
1813
"""Generate a changelog based on the commit history."""
@@ -71,7 +66,9 @@ def __call__(self):
7166
entries[current_key][commit_type].append(processed_commit)
7267
break
7368

74-
template_file = pkg_resources.read_text(cz, "changelog_template.j2")
69+
template_file = pkg_resources.resource_string(
70+
__name__, "../templates/changelog_template.j2"
71+
).decode("utf-8")
7572
jinja_template = Template(template_file)
7673
changelog_str = jinja_template.render(entries=entries)
7774
if self.dry_run:

commitizen/templates/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)