python-kacl 0.6.5__tar.gz → 0.6.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.
Files changed (32) hide show
  1. {python_kacl-0.6.5/python_kacl.egg-info → python_kacl-0.6.7}/PKG-INFO +273 -21
  2. {python_kacl-0.6.5 → python_kacl-0.6.7}/README.md +272 -20
  3. {python_kacl-0.6.5 → python_kacl-0.6.7}/kacl/__init__.py +4 -4
  4. {python_kacl-0.6.5 → python_kacl-0.6.7}/kacl/changes.py +2 -0
  5. {python_kacl-0.6.5 → python_kacl-0.6.7}/kacl/config/kacl-default.yml +5 -1
  6. {python_kacl-0.6.5 → python_kacl-0.6.7}/kacl/config.py +6 -0
  7. {python_kacl-0.6.5 → python_kacl-0.6.7}/kacl/document.py +118 -12
  8. {python_kacl-0.6.5 → python_kacl-0.6.7}/kacl/kacl_cli.py +79 -5
  9. {python_kacl-0.6.5 → python_kacl-0.6.7/python_kacl.egg-info}/PKG-INFO +273 -21
  10. {python_kacl-0.6.5 → python_kacl-0.6.7}/python_kacl.egg-info/SOURCES.txt +1 -0
  11. {python_kacl-0.6.5 → python_kacl-0.6.7}/setup.py +1 -1
  12. {python_kacl-0.6.5 → python_kacl-0.6.7}/tests/test_cli.py +102 -3
  13. python_kacl-0.6.7/tests/test_cli_workflow.py +184 -0
  14. {python_kacl-0.6.5 → python_kacl-0.6.7}/LICENSE +0 -0
  15. {python_kacl-0.6.5 → python_kacl-0.6.7}/MANIFEST.in +0 -0
  16. {python_kacl-0.6.5 → python_kacl-0.6.7}/kacl/__main__.py +0 -0
  17. {python_kacl-0.6.5 → python_kacl-0.6.7}/kacl/element.py +0 -0
  18. {python_kacl-0.6.5 → python_kacl-0.6.7}/kacl/exception.py +0 -0
  19. {python_kacl-0.6.5 → python_kacl-0.6.7}/kacl/jira_client.py +0 -0
  20. {python_kacl-0.6.5 → python_kacl-0.6.7}/kacl/link_provider.py +0 -0
  21. {python_kacl-0.6.5 → python_kacl-0.6.7}/kacl/parser.py +0 -0
  22. {python_kacl-0.6.5 → python_kacl-0.6.7}/kacl/serializer.py +0 -0
  23. {python_kacl-0.6.5 → python_kacl-0.6.7}/kacl/utils.py +0 -0
  24. {python_kacl-0.6.5 → python_kacl-0.6.7}/kacl/validation.py +0 -0
  25. {python_kacl-0.6.5 → python_kacl-0.6.7}/kacl/version.py +0 -0
  26. {python_kacl-0.6.5 → python_kacl-0.6.7}/python_kacl.egg-info/dependency_links.txt +0 -0
  27. {python_kacl-0.6.5 → python_kacl-0.6.7}/python_kacl.egg-info/entry_points.txt +0 -0
  28. {python_kacl-0.6.5 → python_kacl-0.6.7}/python_kacl.egg-info/not-zip-safe +0 -0
  29. {python_kacl-0.6.5 → python_kacl-0.6.7}/python_kacl.egg-info/requires.txt +0 -0
  30. {python_kacl-0.6.5 → python_kacl-0.6.7}/python_kacl.egg-info/top_level.txt +0 -0
  31. {python_kacl-0.6.5 → python_kacl-0.6.7}/setup.cfg +0 -0
  32. {python_kacl-0.6.5 → python_kacl-0.6.7}/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.5
3
+ Version: 0.6.7
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.
@@ -254,8 +355,9 @@ kacl-cli get 0.2.2
254
355
  ```
255
356
  Usage: kacl-cli add [OPTIONS] SECTION MESSAGE
256
357
 
257
- Adds a given message to a specified unreleased section. Use '--modify' to
258
- 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.
259
361
 
260
362
  Options:
261
363
  -m, --modify This option will add the changes directly into changelog file
@@ -277,7 +379,9 @@ Usage: kacl-cli release [OPTIONS] VERSION
277
379
 
278
380
  Creates a release for the latest 'unreleased' changes. Use '--modify' to
279
381
  directly modify the changelog file. You can automatically use the latest
280
- 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.
281
385
 
282
386
  Example:
283
387
 
@@ -429,6 +533,102 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
429
533
  [Unreleased]: https://gitlab.com/schmieder.matthias/python-kacl/compare/v1.0.0...HEAD
430
534
  ```
431
535
 
536
+ ## Changelog Fragments
537
+
538
+ **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.
539
+
540
+ ### Configuration
541
+
542
+ Enable changelog fragments through the `.kacl.yml` configuration file:
543
+
544
+ ```yaml
545
+ kacl:
546
+ stash:
547
+ dir: .kacl_stash
548
+ always: True
549
+ ```
550
+
551
+ **Configuration Options:**
552
+
553
+ - `dir`: Directory where changelog fragments are stored (default: `.kacl_stash`)
554
+ - `always`: When `True`, all `kacl add` commands automatically create fragments instead of modifying the main changelog
555
+
556
+ ### How It Works
557
+
558
+ The stash functionality stores "Unreleased" changes in separate fragment files within the configured stash directory. These fragment files are **git-branch aware**:
559
+
560
+ - **Inside a git repository**: Fragment files are named `{git_branch}.md`
561
+ - **Outside a git repository**: Fragment files use a timestamp-based name
562
+
563
+ 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.
564
+
565
+ ### Usage Patterns
566
+
567
+ #### Automatic Fragment Creation
568
+
569
+ With `always: True` in your configuration, all changelog additions are automatically directed to fragments:
570
+
571
+ ```bash
572
+ kacl add -m Changed "my new changelog entry"
573
+ ```
574
+
575
+ This command creates or updates a fragment file (e.g., `feature-branch.md`) instead of modifying the main `CHANGELOG.md`.
576
+
577
+ #### Manual Fragment Control
578
+
579
+ With `always: False`, you have explicit control over where changes are added:
580
+
581
+ ```bash
582
+ # Add directly to CHANGELOG.md
583
+ kacl add -m Changed "directly to the CHANGELOG.md"
584
+
585
+ # Add to a fragment file
586
+ kacl add -m --stash Changed "into the fragment"
587
+ ```
588
+
589
+ ### Fragment Structure
590
+
591
+ Each fragment file contains a standard changelog structure:
592
+
593
+ ```markdown
594
+ # Changelog
595
+ All notable changes to this project will be documented in this file.
596
+
597
+ 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).
598
+
599
+ ## Unreleased
600
+ ### Changed
601
+ - my new changelog entry
602
+ ```
603
+
604
+ ### Release Integration
605
+
606
+ When executing `kacl release`, the system automatically:
607
+
608
+ 1. **Collects all fragments** from the stash directory
609
+ 2. **Merges fragment content** into the main changelog under the new release version
610
+ 3. **Deletes processed fragments** from the stash directory
611
+ 4. **Stages deletions in git** so fragments are removed when the release is committed
612
+
613
+ This seamless integration ensures that all distributed changes across branches are consolidated into a single release entry.
614
+
615
+ ### Workflow Integration
616
+
617
+ Changelog fragments are fully integrated into all kacl workflows:
618
+
619
+ - **`kacl verify`**: Validates both the main changelog and all fragments
620
+ - **`kacl get`**: Considers fragment content when retrieving version information
621
+ - **Git operations**: Fragment cleanup is automatically handled during release commits
622
+
623
+ ### Benefits
624
+
625
+ - **Eliminates merge conflicts** on changelog files
626
+ - **Enables parallel development** without coordination overhead
627
+ - **Maintains changelog quality** through individual fragment validation
628
+ - **Simplifies release process** with automatic fragment consolidation
629
+ - **Preserves git history** of changelog contributions per branch
630
+
631
+
432
632
  ## Link Generation
433
633
 
434
634
  `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 +781,12 @@ Options:
581
781
 
582
782
  The `comment_template` parameter allows various templating options. The following template variables are available:
583
783
 
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 |
784
+ | Variable | Description |
785
+ | -------------- | ----------------------------------------------------------------------------------------------------- |
786
+ | `new_version` | The version that was just released |
787
+ | `changes` | The markdown content within the change section of your CHANGELOG |
588
788
  | `link` | The link to the version within your source code management system according to the link configuration |
589
- | `env.MYENVVAR` | Any environment variable |
789
+ | `env.MYENVVAR` | Any environment variable |
590
790
 
591
791
  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
792
 
@@ -651,11 +851,11 @@ required _default content_.
651
851
  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
852
  within the config files.
653
853
 
654
- **Default Config**
854
+ ### Default Config
655
855
 
656
856
  ```yaml
657
857
  kacl:
658
- changelog_file: CHANGELOG.md
858
+ file: CHANGELOG.md
659
859
  allowed_header_titles:
660
860
  - Changelog
661
861
  - Change Log
@@ -669,20 +869,20 @@ kacl:
669
869
  default_content:
670
870
  - All notable changes to this project will be documented in this file.
671
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
672
874
  git:
673
- commit: True
875
+ commit: False
674
876
  commit_message: "[skip ci] Releasing Changelog version {new_version}"
675
877
  commit_additional_files: []
676
878
  tag: False
677
879
  tag_name: "v{new_version}"
678
880
  tag_description: "Version v{new_version} released"
679
881
  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
882
+ auto_generate: False
883
+ compare_versions_template: '{host}/compare/{previous_version}...{version}'
884
+ unreleased_changes_template: '{host}/compare/{latest_version}...master'
885
+ initial_version_template: '{host}/tree/{version}'
686
886
  extension:
687
887
  post_release_version_prefix: null
688
888
  issue_tracker:
@@ -703,7 +903,59 @@ kacl:
703
903
  ## 🧭 Reference
704
904
 
705
905
  Code: [Source Code Management System]({link})
706
- ```
906
+ stash:
907
+ directory: .kacl_stash
908
+ always: False
909
+ ```
910
+
911
+ ### Configuration Parameters
912
+
913
+ | Parameter | Type | Default | Description |
914
+ | --------------------------------------- | ------- | -------------------------------------------------------------------- | -------------------------------------------------------- |
915
+ | **Basic Settings** | | | |
916
+ | `file` | string | `CHANGELOG.md` | Path to the changelog file |
917
+ | `allowed_header_titles` | array | `["Changelog", "Change Log"]` | Valid changelog header titles |
918
+ | `allowed_version_sections` | array | `["Added", "Changed", "Deprecated", "Removed", "Fixed", "Security"]` | Valid section names within version entries |
919
+ | `default_content` | array | See default config | Default content lines for new changelog files |
920
+ | **Git Integration** | | | |
921
+ | `git.commit` | boolean | `false` | Automatically commit changelog changes during release |
922
+ | `git.commit_message` | string | `"[skip ci] Releasing Changelog version {new_version}"` | Template for commit messages |
923
+ | `git.commit_additional_files` | array | `[]` | Additional files to include in release commits |
924
+ | `git.tag` | boolean | `false` | Automatically create git tags during release |
925
+ | `git.tag_name` | string | `"v{new_version}"` | Template for git tag names |
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 |
929
+ | **Link Generation** | | | |
930
+ | `links.auto_generate` | boolean | `false` | Automatically generate version links during release |
931
+ | `links.compare_versions_template` | string | `"{host}/compare/{previous_version}...{version}"` | Template for version comparison links |
932
+ | `links.unreleased_changes_template` | string | `"{host}/compare/{latest_version}...master"` | Template for unreleased changes links |
933
+ | `links.initial_version_template` | string | `"{host}/tree/{version}"` | Template for initial version links |
934
+ | **Extensions** | | | |
935
+ | `extension.post_release_version_prefix` | string | `null` | Prefix for post-release/hotfix versions (non-SemVer) |
936
+ | **Issue Tracker Integration** | | | |
937
+ | `issue_tracker.jira.host` | string | `null` | JIRA instance hostname (also reads `JIRA_HOST` env var) |
938
+ | `issue_tracker.jira.username` | string | `null` | JIRA username (also reads `JIRA_USERNAME` env var) |
939
+ | `issue_tracker.jira.password` | string | `null` | JIRA password (also reads `JIRA_PASSWORD` env var) |
940
+ | `issue_tracker.jira.issue_patterns` | array | `["[A-Z]+-[0-9]+"]` | Regex patterns to identify issue references in changelog |
941
+ | `issue_tracker.jira.comment_template` | string | See default config | Template for comments posted to JIRA issues |
942
+ | **Changelog Fragments** | | | |
943
+ | `stash.directory` | string | `.kacl_stash` | Directory for storing changelog fragments |
944
+ | `stash.always` | boolean | `false` | Always use fragments instead of modifying main changelog |
945
+
946
+ ### Template Variables
947
+
948
+ The following variables are available for templating in commit messages, tag names, descriptions, and JIRA comments:
949
+
950
+ | Variable | Description | Example |
951
+ | -------------------- | --------------------------------- | ------------------------------ |
952
+ | `{new_version}` | The version being released | `1.2.3` |
953
+ | `{latest_version}` | The previous version | `1.2.2` |
954
+ | `{previous_version}` | Same as latest_version | `1.2.2` |
955
+ | `{host}` | Git repository host URL | `https://github.com/user/repo` |
956
+ | `{changes}` | Changelog content for the version | Markdown content |
957
+ | `{link}` | Link to the version in SCM | Generated link URL |
958
+ | `{env.VAR_NAME}` | Environment variable | Value of `VAR_NAME` |
707
959
 
708
960
  ## Development
709
961
 
@@ -716,7 +968,7 @@ cd python-kacl
716
968
 
717
969
  # create a virtual env
718
970
  python3 -m venv .venv
719
- source ./venv/bin/activate
971
+ source ./.venv/bin/activate
720
972
 
721
973
  # install in development mode
722
974
  pip install -e .