python-kacl 0.6.6__tar.gz → 0.6.8__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.
Files changed (32) hide show
  1. {python_kacl-0.6.6/python_kacl.egg-info → python_kacl-0.6.8}/PKG-INFO +12 -5
  2. {python_kacl-0.6.6 → python_kacl-0.6.8}/README.md +11 -4
  3. {python_kacl-0.6.6 → python_kacl-0.6.8}/kacl/__init__.py +1 -1
  4. {python_kacl-0.6.6 → python_kacl-0.6.8}/kacl/config/kacl-default.yml +2 -0
  5. {python_kacl-0.6.6 → python_kacl-0.6.8}/kacl/config.py +3 -0
  6. {python_kacl-0.6.6 → python_kacl-0.6.8}/kacl/document.py +6 -5
  7. {python_kacl-0.6.6 → python_kacl-0.6.8}/kacl/kacl_cli.py +5 -4
  8. {python_kacl-0.6.6 → python_kacl-0.6.8}/kacl/utils.py +1 -1
  9. {python_kacl-0.6.6 → python_kacl-0.6.8/python_kacl.egg-info}/PKG-INFO +12 -5
  10. {python_kacl-0.6.6 → python_kacl-0.6.8}/setup.py +1 -1
  11. {python_kacl-0.6.6 → python_kacl-0.6.8}/tests/test_cli.py +53 -0
  12. {python_kacl-0.6.6 → python_kacl-0.6.8}/LICENSE +0 -0
  13. {python_kacl-0.6.6 → python_kacl-0.6.8}/MANIFEST.in +0 -0
  14. {python_kacl-0.6.6 → python_kacl-0.6.8}/kacl/__main__.py +0 -0
  15. {python_kacl-0.6.6 → python_kacl-0.6.8}/kacl/changes.py +0 -0
  16. {python_kacl-0.6.6 → python_kacl-0.6.8}/kacl/element.py +0 -0
  17. {python_kacl-0.6.6 → python_kacl-0.6.8}/kacl/exception.py +0 -0
  18. {python_kacl-0.6.6 → python_kacl-0.6.8}/kacl/jira_client.py +0 -0
  19. {python_kacl-0.6.6 → python_kacl-0.6.8}/kacl/link_provider.py +0 -0
  20. {python_kacl-0.6.6 → python_kacl-0.6.8}/kacl/parser.py +0 -0
  21. {python_kacl-0.6.6 → python_kacl-0.6.8}/kacl/serializer.py +0 -0
  22. {python_kacl-0.6.6 → python_kacl-0.6.8}/kacl/validation.py +0 -0
  23. {python_kacl-0.6.6 → python_kacl-0.6.8}/kacl/version.py +0 -0
  24. {python_kacl-0.6.6 → python_kacl-0.6.8}/python_kacl.egg-info/SOURCES.txt +0 -0
  25. {python_kacl-0.6.6 → python_kacl-0.6.8}/python_kacl.egg-info/dependency_links.txt +0 -0
  26. {python_kacl-0.6.6 → python_kacl-0.6.8}/python_kacl.egg-info/entry_points.txt +0 -0
  27. {python_kacl-0.6.6 → python_kacl-0.6.8}/python_kacl.egg-info/not-zip-safe +0 -0
  28. {python_kacl-0.6.6 → python_kacl-0.6.8}/python_kacl.egg-info/requires.txt +0 -0
  29. {python_kacl-0.6.6 → python_kacl-0.6.8}/python_kacl.egg-info/top_level.txt +0 -0
  30. {python_kacl-0.6.6 → python_kacl-0.6.8}/setup.cfg +0 -0
  31. {python_kacl-0.6.6 → python_kacl-0.6.8}/tests/test_cli_workflow.py +0 -0
  32. {python_kacl-0.6.6 → python_kacl-0.6.8}/tests/test_kacl.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-kacl
3
- Version: 0.6.6
3
+ Version: 0.6.8
4
4
  Summary: Python module and CLI tool for validating and modifying Changelogs in "keep-a-changelog" format"
5
5
  Home-page: https://gitlab.com/schmieder.matthias/python-kacl.git
6
6
  Author: Matthias Schmieder
@@ -355,8 +355,9 @@ kacl-cli get 0.2.2
355
355
  ```
356
356
  Usage: kacl-cli add [OPTIONS] SECTION MESSAGE
357
357
 
358
- Adds a given message to a specified unreleased section. Use '--modify' to
359
- directly modify the changelog file.
358
+ Adds a given message to a specified unreleased section. A new unreleased
359
+ section is added if it doesn't exist. Use '--modify' to directly modify
360
+ the changelog file.
360
361
 
361
362
  Options:
362
363
  -m, --modify This option will add the changes directly into changelog file
@@ -378,7 +379,9 @@ Usage: kacl-cli release [OPTIONS] VERSION
378
379
 
379
380
  Creates a release for the latest 'unreleased' changes. Use '--modify' to
380
381
  directly modify the changelog file. You can automatically use the latest
381
- version by using the version keywords 'major', 'minor', 'patch', 'post'
382
+ version by using the version keywords 'major', 'minor', 'patch', 'post'.
383
+ Creates a new empty unreleased section if not disabled in the configuration
384
+ file.
382
385
 
383
386
  Example:
384
387
 
@@ -866,6 +869,8 @@ kacl:
866
869
  default_content:
867
870
  - All notable changes to this project will be documented in this file.
868
871
  - The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
872
+ release:
873
+ add_unreleased: True
869
874
  git:
870
875
  commit: False
871
876
  commit_message: "[skip ci] Releasing Changelog version {new_version}"
@@ -919,6 +924,8 @@ kacl:
919
924
  | `git.tag` | boolean | `false` | Automatically create git tags during release |
920
925
  | `git.tag_name` | string | `"v{new_version}"` | Template for git tag names |
921
926
  | `git.tag_description` | string | `"Version v{new_version} released"` | Template for git tag descriptions |
927
+ | **Release Settings** | | | |
928
+ | `release.add_unreleased` | boolean | `true` | Automatically add new "Unreleased" section after release |
922
929
  | **Link Generation** | | | |
923
930
  | `links.auto_generate` | boolean | `false` | Automatically generate version links during release |
924
931
  | `links.compare_versions_template` | string | `"{host}/compare/{previous_version}...{version}"` | Template for version comparison links |
@@ -961,7 +968,7 @@ cd python-kacl
961
968
 
962
969
  # create a virtual env
963
970
  python3 -m venv .venv
964
- source ./venv/bin/activate
971
+ source ./.venv/bin/activate
965
972
 
966
973
  # install in development mode
967
974
  pip install -e .
@@ -322,8 +322,9 @@ kacl-cli get 0.2.2
322
322
  ```
323
323
  Usage: kacl-cli add [OPTIONS] SECTION MESSAGE
324
324
 
325
- Adds a given message to a specified unreleased section. Use '--modify' to
326
- directly modify the changelog file.
325
+ Adds a given message to a specified unreleased section. A new unreleased
326
+ section is added if it doesn't exist. Use '--modify' to directly modify
327
+ the changelog file.
327
328
 
328
329
  Options:
329
330
  -m, --modify This option will add the changes directly into changelog file
@@ -345,7 +346,9 @@ Usage: kacl-cli release [OPTIONS] VERSION
345
346
 
346
347
  Creates a release for the latest 'unreleased' changes. Use '--modify' to
347
348
  directly modify the changelog file. You can automatically use the latest
348
- version by using the version keywords 'major', 'minor', 'patch', 'post'
349
+ version by using the version keywords 'major', 'minor', 'patch', 'post'.
350
+ Creates a new empty unreleased section if not disabled in the configuration
351
+ file.
349
352
 
350
353
  Example:
351
354
 
@@ -833,6 +836,8 @@ kacl:
833
836
  default_content:
834
837
  - All notable changes to this project will be documented in this file.
835
838
  - The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
839
+ release:
840
+ add_unreleased: True
836
841
  git:
837
842
  commit: False
838
843
  commit_message: "[skip ci] Releasing Changelog version {new_version}"
@@ -886,6 +891,8 @@ kacl:
886
891
  | `git.tag` | boolean | `false` | Automatically create git tags during release |
887
892
  | `git.tag_name` | string | `"v{new_version}"` | Template for git tag names |
888
893
  | `git.tag_description` | string | `"Version v{new_version} released"` | Template for git tag descriptions |
894
+ | **Release Settings** | | | |
895
+ | `release.add_unreleased` | boolean | `true` | Automatically add new "Unreleased" section after release |
889
896
  | **Link Generation** | | | |
890
897
  | `links.auto_generate` | boolean | `false` | Automatically generate version links during release |
891
898
  | `links.compare_versions_template` | string | `"{host}/compare/{previous_version}...{version}"` | Template for version comparison links |
@@ -928,7 +935,7 @@ cd python-kacl
928
935
 
929
936
  # create a virtual env
930
937
  python3 -m venv .venv
931
- source ./venv/bin/activate
938
+ source ./.venv/bin/activate
932
939
 
933
940
  # install in development mode
934
941
  pip install -e .
@@ -1,5 +1,5 @@
1
1
  # Version of the python-kacl package
2
- __version__ = "0.6.6"
2
+ __version__ = "0.6.8"
3
3
 
4
4
  from kacl.document import KACLDocument
5
5
  from kacl.serializer import KACLMarkdownSerializer
@@ -13,6 +13,8 @@ kacl:
13
13
  default_content:
14
14
  - All notable changes to this project will be documented in this file.
15
15
  - The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
16
+ release:
17
+ add_unreleased: True
16
18
  git:
17
19
  commit: False
18
20
  commit_message: "[skip ci] Releasing Changelog version {new_version}"
@@ -20,6 +20,9 @@ class KACLConfig:
20
20
  self.allowed_header_titles = self.__config.get("allowed_header_titles")
21
21
  self.allowed_version_sections = self.__config.get("allowed_version_sections")
22
22
  self.default_content = self.__config.get("default_content")
23
+ self.add_unreleased = self.__config.get("release", {}).get(
24
+ "add_unreleased", True
25
+ )
23
26
  self.git_tag_name = self.__config.get("git", {}).get("tag_name")
24
27
  self.git_tag_description = self.__config.get("git", {}).get("tag_description")
25
28
  self.changelog_file_path = self.__config.get("file")
@@ -430,13 +430,9 @@ class KACLDocument:
430
430
  # remove current unrelease version from list
431
431
  self.__versions.pop(0)
432
432
 
433
- self.__versions.insert(
434
- 0, KACLVersion(version="Unreleased", link=unreleased_version.link())
435
- )
436
-
437
433
  # convert unreleased version to version
438
434
  self.__versions.insert(
439
- 1,
435
+ 0,
440
436
  KACLVersion(
441
437
  version=version,
442
438
  link=KACLElement(title=version, body=link),
@@ -445,6 +441,11 @@ class KACLDocument:
445
441
  ),
446
442
  )
447
443
 
444
+ if self.config.add_unreleased:
445
+ self.__versions.insert(
446
+ 0, KACLVersion(version="Unreleased", link=unreleased_version.link())
447
+ )
448
+
448
449
  if auto_link:
449
450
  link_provider = self.__get_link_provider()
450
451
  for i in range(2):
@@ -150,10 +150,11 @@ def add(ctx, section, message, modify, stash):
150
150
 
151
151
  kacl_changelog_content = kacl.dump(kacl_changelog)
152
152
  # if stashing is enabled, do not modify the changelog file
153
- if modify and not stash:
154
- with open(kacl_changelog.config.changelog_file_path, "w") as f:
155
- f.write(kacl_changelog_content)
156
- f.close()
153
+ if modify:
154
+ if not stash:
155
+ with open(kacl_changelog.config.changelog_file_path, "w") as f:
156
+ f.write(kacl_changelog_content)
157
+ f.close()
157
158
  else:
158
159
  click.echo(kacl_changelog_content)
159
160
 
@@ -23,7 +23,7 @@ def extract_issue_ids(
23
23
  ids = []
24
24
  for pattern in search_patterns[key]:
25
25
  ids.extend(re.findall(pattern, (version.body())))
26
- issue_ids[key] = ids
26
+ issue_ids[key] = list(set(ids))
27
27
  return issue_ids
28
28
 
29
29
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-kacl
3
- Version: 0.6.6
3
+ Version: 0.6.8
4
4
  Summary: Python module and CLI tool for validating and modifying Changelogs in "keep-a-changelog" format"
5
5
  Home-page: https://gitlab.com/schmieder.matthias/python-kacl.git
6
6
  Author: Matthias Schmieder
@@ -355,8 +355,9 @@ kacl-cli get 0.2.2
355
355
  ```
356
356
  Usage: kacl-cli add [OPTIONS] SECTION MESSAGE
357
357
 
358
- Adds a given message to a specified unreleased section. Use '--modify' to
359
- directly modify the changelog file.
358
+ Adds a given message to a specified unreleased section. A new unreleased
359
+ section is added if it doesn't exist. Use '--modify' to directly modify
360
+ the changelog file.
360
361
 
361
362
  Options:
362
363
  -m, --modify This option will add the changes directly into changelog file
@@ -378,7 +379,9 @@ Usage: kacl-cli release [OPTIONS] VERSION
378
379
 
379
380
  Creates a release for the latest 'unreleased' changes. Use '--modify' to
380
381
  directly modify the changelog file. You can automatically use the latest
381
- version by using the version keywords 'major', 'minor', 'patch', 'post'
382
+ version by using the version keywords 'major', 'minor', 'patch', 'post'.
383
+ Creates a new empty unreleased section if not disabled in the configuration
384
+ file.
382
385
 
383
386
  Example:
384
387
 
@@ -866,6 +869,8 @@ kacl:
866
869
  default_content:
867
870
  - All notable changes to this project will be documented in this file.
868
871
  - The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
872
+ release:
873
+ add_unreleased: True
869
874
  git:
870
875
  commit: False
871
876
  commit_message: "[skip ci] Releasing Changelog version {new_version}"
@@ -919,6 +924,8 @@ kacl:
919
924
  | `git.tag` | boolean | `false` | Automatically create git tags during release |
920
925
  | `git.tag_name` | string | `"v{new_version}"` | Template for git tag names |
921
926
  | `git.tag_description` | string | `"Version v{new_version} released"` | Template for git tag descriptions |
927
+ | **Release Settings** | | | |
928
+ | `release.add_unreleased` | boolean | `true` | Automatically add new "Unreleased" section after release |
922
929
  | **Link Generation** | | | |
923
930
  | `links.auto_generate` | boolean | `false` | Automatically generate version links during release |
924
931
  | `links.compare_versions_template` | string | `"{host}/compare/{previous_version}...{version}"` | Template for version comparison links |
@@ -961,7 +968,7 @@ cd python-kacl
961
968
 
962
969
  # create a virtual env
963
970
  python3 -m venv .venv
964
- source ./venv/bin/activate
971
+ source ./.venv/bin/activate
965
972
 
966
973
  # install in development mode
967
974
  pip install -e .
@@ -11,7 +11,7 @@ this_directory = path.abspath(path.dirname(__file__))
11
11
  with open(path.join(this_directory, "README.md"), encoding="utf-8") as f:
12
12
  long_description = f.read()
13
13
 
14
- version = "0.6.6"
14
+ version = "0.6.8"
15
15
 
16
16
  version = f"{version}{os.environ.get('PIP_VERSION_POSTFIX', '')}"
17
17
 
@@ -285,6 +285,31 @@ def test_release_major(tmp_path, snapshot):
285
285
  snapshot_directory(snapshot=snapshot, directory_path=project_root_path)
286
286
 
287
287
 
288
+ @freeze_time("2023-01-01")
289
+ def test_release_major_no_unreleased(tmp_path, snapshot):
290
+ runner = CliRunner()
291
+ resources_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "data/")
292
+ changelog_file = os.path.join(resources_dir, "CHANGELOG_with_changes.md")
293
+
294
+ with runner.isolated_filesystem(temp_dir=tmp_path) as project_root_path:
295
+ shutil.copyfile(changelog_file, os.path.join(project_root_path, "CHANGELOG.md"))
296
+ result = runner.invoke(
297
+ cli,
298
+ [
299
+ "-c",
300
+ os.path.join(resources_dir, "no-unreleased-config.yml"),
301
+ "-f",
302
+ "CHANGELOG.md",
303
+ "release",
304
+ "major",
305
+ "-m",
306
+ ],
307
+ catch_exceptions=False,
308
+ )
309
+ assert result.exit_code == 0, result.output
310
+ snapshot_directory(snapshot=snapshot, directory_path=project_root_path)
311
+
312
+
288
313
  @freeze_time("2023-01-01")
289
314
  def test_release_custom(tmp_path, snapshot):
290
315
  runner = CliRunner()
@@ -308,6 +333,34 @@ def test_release_custom(tmp_path, snapshot):
308
333
  snapshot_directory(snapshot=snapshot, directory_path=project_root_path)
309
334
 
310
335
 
336
+ @freeze_time("2023-01-01")
337
+ def test_release_no_change(tmp_path, snapshot):
338
+ runner = CliRunner()
339
+ resources_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "data/")
340
+ changelog_file = os.path.join(resources_dir, "CHANGELOG_without_changes.md")
341
+
342
+ with runner.isolated_filesystem(temp_dir=tmp_path) as project_root_path:
343
+ shutil.copyfile(changelog_file, os.path.join(project_root_path, "CHANGELOG.md"))
344
+ result = runner.invoke(
345
+ cli,
346
+ [
347
+ "-f",
348
+ "CHANGELOG.md",
349
+ "release",
350
+ "2.1.1",
351
+ ],
352
+ catch_exceptions=False,
353
+ )
354
+ assert result.exit_code == 1, result.output
355
+
356
+ result = runner.invoke(
357
+ cli,
358
+ ["-f", "CHANGELOG.md", "release", "2.1.1", "-m"],
359
+ catch_exceptions=False,
360
+ )
361
+ assert result.exit_code == 1, result.output
362
+
363
+
311
364
  @freeze_time("2023-01-01")
312
365
  def test_add_change_security(tmp_path, snapshot):
313
366
  runner = CliRunner()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes