python-kacl 0.6.4__tar.gz → 0.6.6__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 (35) hide show
  1. {python_kacl-0.6.4/python_kacl.egg-info → python_kacl-0.6.6}/PKG-INFO +262 -17
  2. {python_kacl-0.6.4 → python_kacl-0.6.6}/README.md +261 -16
  3. {python_kacl-0.6.4 → python_kacl-0.6.6}/kacl/__init__.py +4 -4
  4. {python_kacl-0.6.4 → python_kacl-0.6.6}/kacl/changes.py +2 -0
  5. {python_kacl-0.6.4 → python_kacl-0.6.6}/kacl/config/kacl-default.yml +3 -1
  6. {python_kacl-0.6.4 → python_kacl-0.6.6}/kacl/config.py +3 -0
  7. {python_kacl-0.6.4 → python_kacl-0.6.6}/kacl/document.py +112 -7
  8. {python_kacl-0.6.4 → python_kacl-0.6.6}/kacl/kacl_cli.py +76 -3
  9. {python_kacl-0.6.4 → python_kacl-0.6.6}/kacl/serializer.py +7 -2
  10. {python_kacl-0.6.4 → python_kacl-0.6.6/python_kacl.egg-info}/PKG-INFO +262 -17
  11. {python_kacl-0.6.4 → python_kacl-0.6.6}/python_kacl.egg-info/SOURCES.txt +1 -2
  12. {python_kacl-0.6.4 → python_kacl-0.6.6}/python_kacl.egg-info/entry_points.txt +1 -0
  13. python_kacl-0.6.6/python_kacl.egg-info/top_level.txt +1 -0
  14. {python_kacl-0.6.4 → python_kacl-0.6.6}/setup.py +8 -3
  15. {python_kacl-0.6.4 → python_kacl-0.6.6}/tests/test_cli.py +49 -3
  16. python_kacl-0.6.6/tests/test_cli_workflow.py +184 -0
  17. {python_kacl-0.6.4 → python_kacl-0.6.6}/tests/test_kacl.py +17 -8
  18. python_kacl-0.6.4/python_kacl.egg-info/top_level.txt +0 -2
  19. python_kacl-0.6.4/tests/__init__.py +0 -1
  20. python_kacl-0.6.4/tests/snapshot_directory.py +0 -42
  21. {python_kacl-0.6.4 → python_kacl-0.6.6}/LICENSE +0 -0
  22. {python_kacl-0.6.4 → python_kacl-0.6.6}/MANIFEST.in +0 -0
  23. {python_kacl-0.6.4 → python_kacl-0.6.6}/kacl/__main__.py +0 -0
  24. {python_kacl-0.6.4 → python_kacl-0.6.6}/kacl/element.py +0 -0
  25. {python_kacl-0.6.4 → python_kacl-0.6.6}/kacl/exception.py +0 -0
  26. {python_kacl-0.6.4 → python_kacl-0.6.6}/kacl/jira_client.py +0 -0
  27. {python_kacl-0.6.4 → python_kacl-0.6.6}/kacl/link_provider.py +0 -0
  28. {python_kacl-0.6.4 → python_kacl-0.6.6}/kacl/parser.py +0 -0
  29. {python_kacl-0.6.4 → python_kacl-0.6.6}/kacl/utils.py +0 -0
  30. {python_kacl-0.6.4 → python_kacl-0.6.6}/kacl/validation.py +0 -0
  31. {python_kacl-0.6.4 → python_kacl-0.6.6}/kacl/version.py +0 -0
  32. {python_kacl-0.6.4 → python_kacl-0.6.6}/python_kacl.egg-info/dependency_links.txt +0 -0
  33. {python_kacl-0.6.4 → python_kacl-0.6.6}/python_kacl.egg-info/not-zip-safe +0 -0
  34. {python_kacl-0.6.4 → python_kacl-0.6.6}/python_kacl.egg-info/requires.txt +0 -0
  35. {python_kacl-0.6.4 → python_kacl-0.6.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-kacl
3
- Version: 0.6.4
3
+ Version: 0.6.6
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
@@ -47,12 +47,23 @@ A tool for verifying and modifying changelog in the [**K**eep-**A-C**hange-**L**
47
47
  - [Docker](#docker)
48
48
  - [pre-commit](#pre-commit)
49
49
  - [CLI](#cli)
50
+ - [Initialize a new project](#initialize-a-new-project)
50
51
  - [Create a Changelog](#create-a-changelog)
51
52
  - [Verify a Changelog](#verify-a-changelog)
52
53
  - [Print the current release version](#print-the-current-release-version)
53
54
  - [Print a single release changelog](#print-a-single-release-changelog)
54
55
  - [Add an entry to an unreleased section](#add-an-entry-to-an-unreleased-section)
55
56
  - [Prepare a Changelog for a Release](#prepare-a-changelog-for-a-release)
57
+ - [Changelog Fragments](#changelog-fragments)
58
+ - [Configuration](#configuration)
59
+ - [How It Works](#how-it-works)
60
+ - [Usage Patterns](#usage-patterns)
61
+ - [Automatic Fragment Creation](#automatic-fragment-creation)
62
+ - [Manual Fragment Control](#manual-fragment-control)
63
+ - [Fragment Structure](#fragment-structure)
64
+ - [Release Integration](#release-integration)
65
+ - [Workflow Integration](#workflow-integration)
66
+ - [Benefits](#benefits)
56
67
  - [Link Generation](#link-generation)
57
68
  - [Squashing releases](#squashing-releases)
58
69
  - [Example](#example)
@@ -63,6 +74,9 @@ A tool for verifying and modifying changelog in the [**K**eep-**A-C**hange-**L**
63
74
  - [Extensions](#extensions)
64
75
  - [Post-release/Hotfix](#post-releasehotfix)
65
76
  - [Config file](#config-file)
77
+ - [Default Config](#default-config)
78
+ - [Configuration Parameters](#configuration-parameters)
79
+ - [Template Variables](#template-variables)
66
80
  - [Development](#development)
67
81
 
68
82
  ## Installation
@@ -143,10 +157,97 @@ Commands:
143
157
  verify Verifies if the changelog is in "keep-a-changelog" format.
144
158
  ```
145
159
 
160
+ ## Initialize a new project
146
161
 
147
- ## Create a Changelog
162
+ ```bash
163
+ Usage: kacl-cli init [OPTIONS]
164
+
165
+ Initializes a project with all necessary kacl setting.
166
+
167
+ Options:
168
+ -f, --force Will overwrite existing files.
169
+ --help Show this message and exit.
170
+ ```
171
+
172
+ The `init` command provides a quick way to set up a new project with all necessary KACL files and configuration. This command creates two essential files:
173
+
174
+ 1. **CHANGELOG.md** - A new changelog file with the standard Keep a Changelog format
175
+ 2. **.kacl.yml** - A complete configuration file with all available options and sensible defaults
148
176
 
177
+ **Usage**
178
+
179
+ ```bash
180
+ kacl-cli init
181
+ ```
182
+
183
+ This will create both files in the current directory. If either file already exists, the command will fail unless you use the `--force` option:
184
+
185
+ ```bash
186
+ kacl-cli init --force
149
187
  ```
188
+
189
+ **Created Files**
190
+
191
+ The `init` command creates a standard CHANGELOG.md file and copies the complete default configuration. The `.kacl.yml` file includes all available configuration options:
192
+
193
+ ```yaml
194
+ kacl:
195
+ file: CHANGELOG.md
196
+ allowed_header_titles:
197
+ - Changelog
198
+ - Change Log
199
+ allowed_version_sections:
200
+ - Added
201
+ - Changed
202
+ - Deprecated
203
+ - Removed
204
+ - Fixed
205
+ - Security
206
+ default_content:
207
+ - All notable changes to this project will be documented in this file.
208
+ - 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).
209
+ git:
210
+ commit: False
211
+ commit_message: "[skip ci] Releasing Changelog version {new_version}"
212
+ commit_additional_files: []
213
+ tag: False
214
+ tag_name: "v{new_version}"
215
+ tag_description: "Version v{new_version} released"
216
+ links:
217
+ auto_generate: False
218
+ compare_versions_template: '{host}/compare/{previous_version}...{version}'
219
+ unreleased_changes_template: '{host}/compare/{latest_version}...master'
220
+ initial_version_template: '{host}/tree/{version}'
221
+ extension:
222
+ post_release_version_prefix: null
223
+ issue_tracker:
224
+ jira:
225
+ host: null
226
+ username: null
227
+ password: null
228
+ issue_patterns: ["[A-Z]+-[0-9]+"]
229
+ comment_template: |
230
+ # 🚀 New version [v{new_version}]({link})
231
+
232
+ A new release has been created referencing this issue. Please check it out.
233
+
234
+ ## 🚧 Changes in this version
235
+
236
+ {changes}
237
+
238
+ ## 🧭 Reference
239
+
240
+ Code: [Source Code Management System]({link})
241
+ stash:
242
+ directory: .kacl_stash
243
+ always: False
244
+ ```
245
+
246
+ You can customize any of these settings according to your project's needs. The configuration provides sensible defaults that work for most projects while offering extensive customization options for advanced use cases.
247
+
248
+ ## Create a Changelog
249
+
250
+ ```bash
150
251
  Usage: kacl-cli new [OPTIONS]
151
252
 
152
253
  Creates a new changelog.
@@ -429,6 +530,102 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
429
530
  [Unreleased]: https://gitlab.com/schmieder.matthias/python-kacl/compare/v1.0.0...HEAD
430
531
  ```
431
532
 
533
+ ## Changelog Fragments
534
+
535
+ **kacl-cli** supports "changelog fragments" starting from version 6.6.0, which provides a powerful solution for managing unreleased changes in collaborative development environments. This feature helps avoid merge conflicts and simplifies changelog management when multiple developers are working on different branches simultaneously.
536
+
537
+ ### Configuration
538
+
539
+ Enable changelog fragments through the `.kacl.yml` configuration file:
540
+
541
+ ```yaml
542
+ kacl:
543
+ stash:
544
+ dir: .kacl_stash
545
+ always: True
546
+ ```
547
+
548
+ **Configuration Options:**
549
+
550
+ - `dir`: Directory where changelog fragments are stored (default: `.kacl_stash`)
551
+ - `always`: When `True`, all `kacl add` commands automatically create fragments instead of modifying the main changelog
552
+
553
+ ### How It Works
554
+
555
+ The stash functionality stores "Unreleased" changes in separate fragment files within the configured stash directory. These fragment files are **git-branch aware**:
556
+
557
+ - **Inside a git repository**: Fragment files are named `{git_branch}.md`
558
+ - **Outside a git repository**: Fragment files use a timestamp-based name
559
+
560
+ This branch-aware naming ensures maximum segregation of changes, preventing merge conflicts and rebase issues that commonly occur when multiple merge requests modify the same changelog file simultaneously.
561
+
562
+ ### Usage Patterns
563
+
564
+ #### Automatic Fragment Creation
565
+
566
+ With `always: True` in your configuration, all changelog additions are automatically directed to fragments:
567
+
568
+ ```bash
569
+ kacl add -m Changed "my new changelog entry"
570
+ ```
571
+
572
+ This command creates or updates a fragment file (e.g., `feature-branch.md`) instead of modifying the main `CHANGELOG.md`.
573
+
574
+ #### Manual Fragment Control
575
+
576
+ With `always: False`, you have explicit control over where changes are added:
577
+
578
+ ```bash
579
+ # Add directly to CHANGELOG.md
580
+ kacl add -m Changed "directly to the CHANGELOG.md"
581
+
582
+ # Add to a fragment file
583
+ kacl add -m --stash Changed "into the fragment"
584
+ ```
585
+
586
+ ### Fragment Structure
587
+
588
+ Each fragment file contains a standard changelog structure:
589
+
590
+ ```markdown
591
+ # Changelog
592
+ All notable changes to this project will be documented in this file.
593
+
594
+ 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).
595
+
596
+ ## Unreleased
597
+ ### Changed
598
+ - my new changelog entry
599
+ ```
600
+
601
+ ### Release Integration
602
+
603
+ When executing `kacl release`, the system automatically:
604
+
605
+ 1. **Collects all fragments** from the stash directory
606
+ 2. **Merges fragment content** into the main changelog under the new release version
607
+ 3. **Deletes processed fragments** from the stash directory
608
+ 4. **Stages deletions in git** so fragments are removed when the release is committed
609
+
610
+ This seamless integration ensures that all distributed changes across branches are consolidated into a single release entry.
611
+
612
+ ### Workflow Integration
613
+
614
+ Changelog fragments are fully integrated into all kacl workflows:
615
+
616
+ - **`kacl verify`**: Validates both the main changelog and all fragments
617
+ - **`kacl get`**: Considers fragment content when retrieving version information
618
+ - **Git operations**: Fragment cleanup is automatically handled during release commits
619
+
620
+ ### Benefits
621
+
622
+ - **Eliminates merge conflicts** on changelog files
623
+ - **Enables parallel development** without coordination overhead
624
+ - **Maintains changelog quality** through individual fragment validation
625
+ - **Simplifies release process** with automatic fragment consolidation
626
+ - **Preserves git history** of changelog contributions per branch
627
+
628
+
432
629
  ## Link Generation
433
630
 
434
631
  `kacl-cli` let's you easily generate links to your versions. You can automatically generate all links following the desired patterns using `kacl-cli link generate`.
@@ -581,12 +778,12 @@ Options:
581
778
 
582
779
  The `comment_template` parameter allows various templating options. The following template variables are available:
583
780
 
584
- | Variable | Description |
585
- | -------------- | ---------------------------------------------------------------------------------------------------- |
586
- | `new_version` | The version that was just released |
587
- | `changes` | The markdown content within the change section of your CHANGELOG |
781
+ | Variable | Description |
782
+ | -------------- | ----------------------------------------------------------------------------------------------------- |
783
+ | `new_version` | The version that was just released |
784
+ | `changes` | The markdown content within the change section of your CHANGELOG |
588
785
  | `link` | The link to the version within your source code management system according to the link configuration |
589
- | `env.MYENVVAR` | Any environment variable |
786
+ | `env.MYENVVAR` | Any environment variable |
590
787
 
591
788
  This flexibility allows you to adapt the comment patterns to your needs and dynamically create them. For example, adding CI/CD information can be easily achieved as follows:
592
789
 
@@ -651,11 +848,11 @@ required _default content_.
651
848
  By specifying a `.kacl.yml` with any of those options, the _default config_ will be merged with those local changes. Most options are also available on the CLI which take precedence over the ones
652
849
  within the config files.
653
850
 
654
- **Default Config**
851
+ ### Default Config
655
852
 
656
853
  ```yaml
657
854
  kacl:
658
- changelog_file: CHANGELOG.md
855
+ file: CHANGELOG.md
659
856
  allowed_header_titles:
660
857
  - Changelog
661
858
  - Change Log
@@ -670,19 +867,17 @@ kacl:
670
867
  - All notable changes to this project will be documented in this file.
671
868
  - 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).
672
869
  git:
673
- commit: True
870
+ commit: False
674
871
  commit_message: "[skip ci] Releasing Changelog version {new_version}"
675
872
  commit_additional_files: []
676
873
  tag: False
677
874
  tag_name: "v{new_version}"
678
875
  tag_description: "Version v{new_version} released"
679
876
  links:
680
- # The host url is optional and will be automatically determined using your git repository
681
- # host_url: https://github.com/mschmieder/kacl-cli
682
- compare_versions_template: '{host}/compare/{previous_version}...{version}'
683
- unreleased_changes_template: '{host}/compare/{latest_version}...master'
684
- initial_version_template: '{host}/tree/{version}'
685
- auto_generate: True
877
+ auto_generate: False
878
+ compare_versions_template: '{host}/compare/{previous_version}...{version}'
879
+ unreleased_changes_template: '{host}/compare/{latest_version}...master'
880
+ initial_version_template: '{host}/tree/{version}'
686
881
  extension:
687
882
  post_release_version_prefix: null
688
883
  issue_tracker:
@@ -703,7 +898,57 @@ kacl:
703
898
  ## 🧭 Reference
704
899
 
705
900
  Code: [Source Code Management System]({link})
706
- ```
901
+ stash:
902
+ directory: .kacl_stash
903
+ always: False
904
+ ```
905
+
906
+ ### Configuration Parameters
907
+
908
+ | Parameter | Type | Default | Description |
909
+ | --------------------------------------- | ------- | -------------------------------------------------------------------- | -------------------------------------------------------- |
910
+ | **Basic Settings** | | | |
911
+ | `file` | string | `CHANGELOG.md` | Path to the changelog file |
912
+ | `allowed_header_titles` | array | `["Changelog", "Change Log"]` | Valid changelog header titles |
913
+ | `allowed_version_sections` | array | `["Added", "Changed", "Deprecated", "Removed", "Fixed", "Security"]` | Valid section names within version entries |
914
+ | `default_content` | array | See default config | Default content lines for new changelog files |
915
+ | **Git Integration** | | | |
916
+ | `git.commit` | boolean | `false` | Automatically commit changelog changes during release |
917
+ | `git.commit_message` | string | `"[skip ci] Releasing Changelog version {new_version}"` | Template for commit messages |
918
+ | `git.commit_additional_files` | array | `[]` | Additional files to include in release commits |
919
+ | `git.tag` | boolean | `false` | Automatically create git tags during release |
920
+ | `git.tag_name` | string | `"v{new_version}"` | Template for git tag names |
921
+ | `git.tag_description` | string | `"Version v{new_version} released"` | Template for git tag descriptions |
922
+ | **Link Generation** | | | |
923
+ | `links.auto_generate` | boolean | `false` | Automatically generate version links during release |
924
+ | `links.compare_versions_template` | string | `"{host}/compare/{previous_version}...{version}"` | Template for version comparison links |
925
+ | `links.unreleased_changes_template` | string | `"{host}/compare/{latest_version}...master"` | Template for unreleased changes links |
926
+ | `links.initial_version_template` | string | `"{host}/tree/{version}"` | Template for initial version links |
927
+ | **Extensions** | | | |
928
+ | `extension.post_release_version_prefix` | string | `null` | Prefix for post-release/hotfix versions (non-SemVer) |
929
+ | **Issue Tracker Integration** | | | |
930
+ | `issue_tracker.jira.host` | string | `null` | JIRA instance hostname (also reads `JIRA_HOST` env var) |
931
+ | `issue_tracker.jira.username` | string | `null` | JIRA username (also reads `JIRA_USERNAME` env var) |
932
+ | `issue_tracker.jira.password` | string | `null` | JIRA password (also reads `JIRA_PASSWORD` env var) |
933
+ | `issue_tracker.jira.issue_patterns` | array | `["[A-Z]+-[0-9]+"]` | Regex patterns to identify issue references in changelog |
934
+ | `issue_tracker.jira.comment_template` | string | See default config | Template for comments posted to JIRA issues |
935
+ | **Changelog Fragments** | | | |
936
+ | `stash.directory` | string | `.kacl_stash` | Directory for storing changelog fragments |
937
+ | `stash.always` | boolean | `false` | Always use fragments instead of modifying main changelog |
938
+
939
+ ### Template Variables
940
+
941
+ The following variables are available for templating in commit messages, tag names, descriptions, and JIRA comments:
942
+
943
+ | Variable | Description | Example |
944
+ | -------------------- | --------------------------------- | ------------------------------ |
945
+ | `{new_version}` | The version being released | `1.2.3` |
946
+ | `{latest_version}` | The previous version | `1.2.2` |
947
+ | `{previous_version}` | Same as latest_version | `1.2.2` |
948
+ | `{host}` | Git repository host URL | `https://github.com/user/repo` |
949
+ | `{changes}` | Changelog content for the version | Markdown content |
950
+ | `{link}` | Link to the version in SCM | Generated link URL |
951
+ | `{env.VAR_NAME}` | Environment variable | Value of `VAR_NAME` |
707
952
 
708
953
  ## Development
709
954