python-kacl 0.7.6__tar.gz → 0.7.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_kacl-0.7.6 → python_kacl-0.7.7}/PKG-INFO +21 -1
- python_kacl-0.7.6/python_kacl.egg-info/PKG-INFO → python_kacl-0.7.7/README.md +20 -22
- {python_kacl-0.7.6 → python_kacl-0.7.7}/kacl/__init__.py +1 -1
- {python_kacl-0.7.6 → python_kacl-0.7.7}/kacl/document.py +28 -4
- {python_kacl-0.7.6 → python_kacl-0.7.7}/kacl/serializer.py +4 -0
- {python_kacl-0.7.6 → python_kacl-0.7.7}/pyproject.toml +1 -1
- python_kacl-0.7.6/README.md → python_kacl-0.7.7/python_kacl.egg-info/PKG-INFO +42 -0
- {python_kacl-0.7.6 → python_kacl-0.7.7}/tests/test_cli_workflow.py +27 -0
- {python_kacl-0.7.6 → python_kacl-0.7.7}/tests/test_kacl.py +25 -0
- {python_kacl-0.7.6 → python_kacl-0.7.7}/LICENSE +0 -0
- {python_kacl-0.7.6 → python_kacl-0.7.7}/MANIFEST.in +0 -0
- {python_kacl-0.7.6 → python_kacl-0.7.7}/kacl/__main__.py +0 -0
- {python_kacl-0.7.6 → python_kacl-0.7.7}/kacl/changes.py +0 -0
- {python_kacl-0.7.6 → python_kacl-0.7.7}/kacl/config/kacl-default.yml +0 -0
- {python_kacl-0.7.6 → python_kacl-0.7.7}/kacl/config.py +0 -0
- {python_kacl-0.7.6 → python_kacl-0.7.7}/kacl/element.py +0 -0
- {python_kacl-0.7.6 → python_kacl-0.7.7}/kacl/exception.py +0 -0
- {python_kacl-0.7.6 → python_kacl-0.7.7}/kacl/jira_client.py +0 -0
- {python_kacl-0.7.6 → python_kacl-0.7.7}/kacl/kacl_cli.py +0 -0
- {python_kacl-0.7.6 → python_kacl-0.7.7}/kacl/link_provider.py +0 -0
- {python_kacl-0.7.6 → python_kacl-0.7.7}/kacl/parser.py +0 -0
- {python_kacl-0.7.6 → python_kacl-0.7.7}/kacl/utils.py +0 -0
- {python_kacl-0.7.6 → python_kacl-0.7.7}/kacl/validation.py +0 -0
- {python_kacl-0.7.6 → python_kacl-0.7.7}/kacl/version.py +0 -0
- {python_kacl-0.7.6 → python_kacl-0.7.7}/python_kacl.egg-info/SOURCES.txt +0 -0
- {python_kacl-0.7.6 → python_kacl-0.7.7}/python_kacl.egg-info/dependency_links.txt +0 -0
- {python_kacl-0.7.6 → python_kacl-0.7.7}/python_kacl.egg-info/entry_points.txt +0 -0
- {python_kacl-0.7.6 → python_kacl-0.7.7}/python_kacl.egg-info/not-zip-safe +0 -0
- {python_kacl-0.7.6 → python_kacl-0.7.7}/python_kacl.egg-info/requires.txt +0 -0
- {python_kacl-0.7.6 → python_kacl-0.7.7}/python_kacl.egg-info/top_level.txt +0 -0
- {python_kacl-0.7.6 → python_kacl-0.7.7}/requirements.txt +0 -0
- {python_kacl-0.7.6 → python_kacl-0.7.7}/setup.cfg +0 -0
- {python_kacl-0.7.6 → python_kacl-0.7.7}/tests/test_cli.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-kacl
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.7
|
|
4
4
|
Summary: Python module and CLI tool for validating and modifying Changelogs in "keep-a-changelog" format"
|
|
5
5
|
Author-email: Matthias Schmieder <schmieder.matthias@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -56,6 +56,7 @@ A tool for verifying and modifying changelog in the [**K**eep-**A-C**hange-**L**
|
|
|
56
56
|
- [Workflow Integration](#workflow-integration)
|
|
57
57
|
- [Benefits](#benefits)
|
|
58
58
|
- [Link Generation](#link-generation)
|
|
59
|
+
- [Custom Link References](#custom-link-references)
|
|
59
60
|
- [Squashing releases](#squashing-releases)
|
|
60
61
|
- [Example](#example)
|
|
61
62
|
- [Issue Management Integration](#issue-management-integration)
|
|
@@ -778,6 +779,25 @@ kacl:
|
|
|
778
779
|
|
|
779
780
|
Using the python format syntax you can generate any links you want. The available replacement variables are `version`, `previous_version`, `host` and `latest_version`.
|
|
780
781
|
|
|
782
|
+
### Custom Link References
|
|
783
|
+
|
|
784
|
+
Besides version links, you can use your own link references in changelog entries, for example to link to merge requests or issues. A reference is accepted as long as `[label]` is used in at least one entry:
|
|
785
|
+
|
|
786
|
+
```markdown
|
|
787
|
+
## [1.0.0] - 2026-04-10
|
|
788
|
+
|
|
789
|
+
### Changed
|
|
790
|
+
|
|
791
|
+
- a big change ([!1234])
|
|
792
|
+
|
|
793
|
+
[1.0.0]: https://gitlab.com/my/repo/-/tags/v1.0.0
|
|
794
|
+
[!1234]: https://gitlab.com/my/repo/-/merge_requests/1234
|
|
795
|
+
```
|
|
796
|
+
|
|
797
|
+
- `kacl-cli verify` reports references that are never used with `Link not referenced anywhere in the document`.
|
|
798
|
+
- Custom references are preserved when `kacl-cli` rewrites the changelog (`add`, `release`, ...). They are written after the version links.
|
|
799
|
+
- `kacl-cli squash` removes the references of the squashed versions.
|
|
800
|
+
|
|
781
801
|
## Squashing releases
|
|
782
802
|
|
|
783
803
|
If you are follwing a automated versioning approach, you will often times create a number of versions that might clutter Changelog. For this purpose, `kacl-cli` provides a `squash` command that let's you squash releases into a single one without loosing valuable information.
|
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: python-kacl
|
|
3
|
-
Version: 0.7.6
|
|
4
|
-
Summary: Python module and CLI tool for validating and modifying Changelogs in "keep-a-changelog" format"
|
|
5
|
-
Author-email: Matthias Schmieder <schmieder.matthias@gmail.com>
|
|
6
|
-
License: MIT
|
|
7
|
-
Project-URL: Homepage, https://gitlab.com/schmieder.matthias/python-kacl.git
|
|
8
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
-
Classifier: Programming Language :: Python :: 3
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
11
|
-
Classifier: Intended Audience :: Developers
|
|
12
|
-
Classifier: Topic :: Software Development :: Version Control
|
|
13
|
-
Requires-Python: >=3.9
|
|
14
|
-
Description-Content-Type: text/markdown
|
|
15
|
-
License-File: LICENSE
|
|
16
|
-
Requires-Dist: click
|
|
17
|
-
Requires-Dist: semver
|
|
18
|
-
Requires-Dist: gitpython
|
|
19
|
-
Requires-Dist: pyyaml
|
|
20
|
-
Requires-Dist: jira
|
|
21
|
-
Dynamic: license-file
|
|
22
|
-
|
|
23
1
|
# python-kacl
|
|
24
2
|
|
|
25
3
|
[](https://gitlab.com/schmieder.matthias/python-kacl)
|
|
@@ -56,6 +34,7 @@ A tool for verifying and modifying changelog in the [**K**eep-**A-C**hange-**L**
|
|
|
56
34
|
- [Workflow Integration](#workflow-integration)
|
|
57
35
|
- [Benefits](#benefits)
|
|
58
36
|
- [Link Generation](#link-generation)
|
|
37
|
+
- [Custom Link References](#custom-link-references)
|
|
59
38
|
- [Squashing releases](#squashing-releases)
|
|
60
39
|
- [Example](#example)
|
|
61
40
|
- [Issue Management Integration](#issue-management-integration)
|
|
@@ -778,6 +757,25 @@ kacl:
|
|
|
778
757
|
|
|
779
758
|
Using the python format syntax you can generate any links you want. The available replacement variables are `version`, `previous_version`, `host` and `latest_version`.
|
|
780
759
|
|
|
760
|
+
### Custom Link References
|
|
761
|
+
|
|
762
|
+
Besides version links, you can use your own link references in changelog entries, for example to link to merge requests or issues. A reference is accepted as long as `[label]` is used in at least one entry:
|
|
763
|
+
|
|
764
|
+
```markdown
|
|
765
|
+
## [1.0.0] - 2026-04-10
|
|
766
|
+
|
|
767
|
+
### Changed
|
|
768
|
+
|
|
769
|
+
- a big change ([!1234])
|
|
770
|
+
|
|
771
|
+
[1.0.0]: https://gitlab.com/my/repo/-/tags/v1.0.0
|
|
772
|
+
[!1234]: https://gitlab.com/my/repo/-/merge_requests/1234
|
|
773
|
+
```
|
|
774
|
+
|
|
775
|
+
- `kacl-cli verify` reports references that are never used with `Link not referenced anywhere in the document`.
|
|
776
|
+
- Custom references are preserved when `kacl-cli` rewrites the changelog (`add`, `release`, ...). They are written after the version links.
|
|
777
|
+
- `kacl-cli squash` removes the references of the squashed versions.
|
|
778
|
+
|
|
781
779
|
## Squashing releases
|
|
782
780
|
|
|
783
781
|
If you are follwing a automated versioning approach, you will often times create a number of versions that might clutter Changelog. For this purpose, `kacl-cli` provides a `squash` command that let's you squash releases into a single one without loosing valuable information.
|
|
@@ -229,10 +229,11 @@ class KACLDocument:
|
|
|
229
229
|
pass
|
|
230
230
|
|
|
231
231
|
# 4 link references
|
|
232
|
-
# 4.1 check that
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
232
|
+
# 4.1 check that every reference is either a version link or is used
|
|
233
|
+
# inside of the changelog (e.g. "[!1234]" pointing to a merge request)
|
|
234
|
+
content = self._referencable_content().lower()
|
|
235
|
+
for link in self.extra_link_references():
|
|
236
|
+
if f"[{link.title().lower()}]" not in content:
|
|
236
237
|
validation.add_error(
|
|
237
238
|
line=link.raw(),
|
|
238
239
|
line_number=link.line_number(),
|
|
@@ -243,6 +244,27 @@ class KACLDocument:
|
|
|
243
244
|
|
|
244
245
|
return validation
|
|
245
246
|
|
|
247
|
+
def extra_link_references(self):
|
|
248
|
+
"""Returns all link references that do not belong to a version."""
|
|
249
|
+
version_strings = [v.version().lower() for v in self.__versions]
|
|
250
|
+
return [
|
|
251
|
+
link
|
|
252
|
+
for label, link in self.__link_references.items()
|
|
253
|
+
if label.lower() not in version_strings
|
|
254
|
+
]
|
|
255
|
+
|
|
256
|
+
def _referencable_content(self):
|
|
257
|
+
"""Returns the text of all versions in which link references can be used."""
|
|
258
|
+
parts = []
|
|
259
|
+
for v in self.__versions:
|
|
260
|
+
parts.append(v.body() or "")
|
|
261
|
+
try:
|
|
262
|
+
for changes in v.sections().values():
|
|
263
|
+
parts.extend(changes.items())
|
|
264
|
+
except ValueError:
|
|
265
|
+
pass
|
|
266
|
+
return "\n".join(parts)
|
|
267
|
+
|
|
246
268
|
def is_valid(self):
|
|
247
269
|
"""Checks if the current changelog is valid
|
|
248
270
|
Returns:
|
|
@@ -289,6 +311,8 @@ class KACLDocument:
|
|
|
289
311
|
else:
|
|
290
312
|
change = f"[{v.version()}] {change}"
|
|
291
313
|
squash_version.add(section, change)
|
|
314
|
+
# the squashed version is gone, so is its link reference
|
|
315
|
+
self.__link_references.pop(v.version().lower(), None)
|
|
292
316
|
|
|
293
317
|
versions_unsquashed.append(squash_version)
|
|
294
318
|
versions_unsquashed.sort(reverse=True)
|
|
@@ -30,6 +30,10 @@ class KACLMarkdownSerializer:
|
|
|
30
30
|
if version.has_link_reference():
|
|
31
31
|
link_references.append(self.__serialize_link_reference(version))
|
|
32
32
|
|
|
33
|
+
# keep references that do not belong to a version (e.g. merge requests)
|
|
34
|
+
for link in document.extra_link_references():
|
|
35
|
+
link_references.append(f"[{link.title()}]: {link.body()}")
|
|
36
|
+
|
|
33
37
|
elif isinstance(document, KACLVersion):
|
|
34
38
|
data.extend([self.__serialize_version(document), ""])
|
|
35
39
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "python-kacl"
|
|
7
|
-
version = "0.7.
|
|
7
|
+
version = "0.7.7"
|
|
8
8
|
description = "Python module and CLI tool for validating and modifying Changelogs in \"keep-a-changelog\" format\""
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: python-kacl
|
|
3
|
+
Version: 0.7.7
|
|
4
|
+
Summary: Python module and CLI tool for validating and modifying Changelogs in "keep-a-changelog" format"
|
|
5
|
+
Author-email: Matthias Schmieder <schmieder.matthias@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://gitlab.com/schmieder.matthias/python-kacl.git
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Topic :: Software Development :: Version Control
|
|
13
|
+
Requires-Python: >=3.9
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: click
|
|
17
|
+
Requires-Dist: semver
|
|
18
|
+
Requires-Dist: gitpython
|
|
19
|
+
Requires-Dist: pyyaml
|
|
20
|
+
Requires-Dist: jira
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
1
23
|
# python-kacl
|
|
2
24
|
|
|
3
25
|
[](https://gitlab.com/schmieder.matthias/python-kacl)
|
|
@@ -34,6 +56,7 @@ A tool for verifying and modifying changelog in the [**K**eep-**A-C**hange-**L**
|
|
|
34
56
|
- [Workflow Integration](#workflow-integration)
|
|
35
57
|
- [Benefits](#benefits)
|
|
36
58
|
- [Link Generation](#link-generation)
|
|
59
|
+
- [Custom Link References](#custom-link-references)
|
|
37
60
|
- [Squashing releases](#squashing-releases)
|
|
38
61
|
- [Example](#example)
|
|
39
62
|
- [Issue Management Integration](#issue-management-integration)
|
|
@@ -756,6 +779,25 @@ kacl:
|
|
|
756
779
|
|
|
757
780
|
Using the python format syntax you can generate any links you want. The available replacement variables are `version`, `previous_version`, `host` and `latest_version`.
|
|
758
781
|
|
|
782
|
+
### Custom Link References
|
|
783
|
+
|
|
784
|
+
Besides version links, you can use your own link references in changelog entries, for example to link to merge requests or issues. A reference is accepted as long as `[label]` is used in at least one entry:
|
|
785
|
+
|
|
786
|
+
```markdown
|
|
787
|
+
## [1.0.0] - 2026-04-10
|
|
788
|
+
|
|
789
|
+
### Changed
|
|
790
|
+
|
|
791
|
+
- a big change ([!1234])
|
|
792
|
+
|
|
793
|
+
[1.0.0]: https://gitlab.com/my/repo/-/tags/v1.0.0
|
|
794
|
+
[!1234]: https://gitlab.com/my/repo/-/merge_requests/1234
|
|
795
|
+
```
|
|
796
|
+
|
|
797
|
+
- `kacl-cli verify` reports references that are never used with `Link not referenced anywhere in the document`.
|
|
798
|
+
- Custom references are preserved when `kacl-cli` rewrites the changelog (`add`, `release`, ...). They are written after the version links.
|
|
799
|
+
- `kacl-cli squash` removes the references of the squashed versions.
|
|
800
|
+
|
|
759
801
|
## Squashing releases
|
|
760
802
|
|
|
761
803
|
If you are follwing a automated versioning approach, you will often times create a number of versions that might clutter Changelog. For this purpose, `kacl-cli` provides a `squash` command that let's you squash releases into a single one without loosing valuable information.
|
|
@@ -223,3 +223,30 @@ def test_release_with_nested_stash_directory(tmp_path):
|
|
|
223
223
|
)
|
|
224
224
|
assert result.exit_code == 0, result.output
|
|
225
225
|
assert os.listdir(stash_dir) == []
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
def test_non_version_link_reference_survives_release(tmp_path):
|
|
229
|
+
runner = CliRunner()
|
|
230
|
+
changelog = (
|
|
231
|
+
"# Changelog\n\n"
|
|
232
|
+
"All notable changes to this project will be documented in this file.\n\n"
|
|
233
|
+
"The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), "
|
|
234
|
+
"and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n"
|
|
235
|
+
"## [Unreleased]\n\n"
|
|
236
|
+
"### Changed\n\n"
|
|
237
|
+
"- a big change ([!1234])\n\n"
|
|
238
|
+
"[Unreleased]: https://gitlab.com/my/repo/-/compare/v0.9.0...HEAD\n"
|
|
239
|
+
"[!1234]: https://gitlab.com/my/repo/-/merge_requests/1234\n"
|
|
240
|
+
)
|
|
241
|
+
with runner.isolated_filesystem(temp_dir=tmp_path):
|
|
242
|
+
with open("CHANGELOG.md", "w") as f:
|
|
243
|
+
f.write(changelog)
|
|
244
|
+
result = runner.invoke(
|
|
245
|
+
cli,
|
|
246
|
+
["-f", "CHANGELOG.md", "release", "1.0.0", "-m", "--no-commit"],
|
|
247
|
+
catch_exceptions=False,
|
|
248
|
+
)
|
|
249
|
+
assert result.exit_code == 0, result.output
|
|
250
|
+
with open("CHANGELOG.md") as f:
|
|
251
|
+
content = f.read()
|
|
252
|
+
assert "[!1234]: https://gitlab.com/my/repo/-/merge_requests/1234" in content
|
|
@@ -680,3 +680,28 @@ def test_validate_reports_every_duplicated_section():
|
|
|
680
680
|
(17, "### Added"),
|
|
681
681
|
(21, "### Changed"),
|
|
682
682
|
]
|
|
683
|
+
|
|
684
|
+
|
|
685
|
+
MR_CHANGELOG = (
|
|
686
|
+
"# Changelog\n\n"
|
|
687
|
+
"All notable changes to this project will be documented in this file.\n\n"
|
|
688
|
+
"The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), "
|
|
689
|
+
"and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n"
|
|
690
|
+
"## [1.0.0] - 2026-04-10\n\n"
|
|
691
|
+
"### Changed\n\n"
|
|
692
|
+
"- a big change ([!1234])\n\n"
|
|
693
|
+
"[1.0.0]: https://gitlab.com/my/repo/-/tags/v1.0.0\n"
|
|
694
|
+
"[!1234]: https://gitlab.com/my/repo/-/merge_requests/1234\n"
|
|
695
|
+
)
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
def test_used_non_version_link_reference_is_valid_and_preserved():
|
|
699
|
+
changelog = kacl.parse(MR_CHANGELOG)
|
|
700
|
+
assert changelog.is_valid()
|
|
701
|
+
assert kacl.dump(changelog) == MR_CHANGELOG
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
def test_unused_non_version_link_reference_is_invalid():
|
|
705
|
+
changelog = kacl.parse(MR_CHANGELOG.replace(" ([!1234])", ""))
|
|
706
|
+
errors = [e.error_message() for e in changelog.validate().errors()]
|
|
707
|
+
assert errors == ["Link not referenced anywhere in the document"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|