changes-semver 6.0.5__tar.gz → 6.0.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.
- {changes_semver-6.0.5 → changes_semver-6.0.7}/PKG-INFO +23 -2
- {changes_semver-6.0.5 → changes_semver-6.0.7}/README.md +21 -1
- {changes_semver-6.0.5 → changes_semver-6.0.7}/changes_semver/changes.py +32 -36
- {changes_semver-6.0.5 → changes_semver-6.0.7}/changes_semver.egg-info/PKG-INFO +23 -2
- {changes_semver-6.0.5 → changes_semver-6.0.7}/changes_semver.egg-info/SOURCES.txt +0 -1
- {changes_semver-6.0.5 → changes_semver-6.0.7}/changes_semver.egg-info/requires.txt +1 -0
- {changes_semver-6.0.5 → changes_semver-6.0.7}/pyproject.toml +1 -0
- {changes_semver-6.0.5 → changes_semver-6.0.7}/tests/test_cli.py +1 -2
- changes_semver-6.0.5/changes_semver/cli.py +0 -80
- {changes_semver-6.0.5 → changes_semver-6.0.7}/LICENSE +0 -0
- {changes_semver-6.0.5 → changes_semver-6.0.7}/changes_semver/__init__.py +0 -0
- {changes_semver-6.0.5 → changes_semver-6.0.7}/changes_semver/__main__.py +0 -0
- {changes_semver-6.0.5 → changes_semver-6.0.7}/changes_semver/templates/multiple.markdown +0 -0
- {changes_semver-6.0.5 → changes_semver-6.0.7}/changes_semver/templates/single.markdown +0 -0
- {changes_semver-6.0.5 → changes_semver-6.0.7}/changes_semver.egg-info/dependency_links.txt +0 -0
- {changes_semver-6.0.5 → changes_semver-6.0.7}/changes_semver.egg-info/entry_points.txt +0 -0
- {changes_semver-6.0.5 → changes_semver-6.0.7}/changes_semver.egg-info/top_level.txt +0 -0
- {changes_semver-6.0.5 → changes_semver-6.0.7}/setup.cfg +0 -0
- {changes_semver-6.0.5 → changes_semver-6.0.7}/setup.py +0 -0
- {changes_semver-6.0.5 → changes_semver-6.0.7}/tests/test_common.py +0 -0
- {changes_semver-6.0.5 → changes_semver-6.0.7}/tests/test_history.py +0 -0
- {changes_semver-6.0.5 → changes_semver-6.0.7}/tests/test_version.py +0 -0
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: changes-semver
|
|
3
|
-
Version: 6.0.
|
|
3
|
+
Version: 6.0.7
|
|
4
4
|
Author-email: Jason Morley <hello@jbmorley.co.uk>
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
7
7
|
License-File: LICENSE
|
|
8
|
+
Requires-Dist: fastcommand
|
|
8
9
|
Requires-Dist: jinja2
|
|
9
10
|
Requires-Dist: pyyaml
|
|
10
11
|
Dynamic: license-file
|
|
11
12
|
|
|
12
|
-
#
|
|
13
|
+
# Changes
|
|
13
14
|
|
|
14
15
|
[](https://github.com/jbmorley/changes/actions/workflows/build.yaml)
|
|
15
16
|
|
|
@@ -85,6 +86,26 @@ Or see the details of specific sub-commands by passing the `--help` flag directl
|
|
|
85
86
|
changes release --help
|
|
86
87
|
```
|
|
87
88
|
|
|
89
|
+
### Alternative Histories
|
|
90
|
+
|
|
91
|
+
Sometimes you might need to provide your own list of changes for specific releases—this can be helpful if you forgot to adhere to Conventional Commits or, perhaps, you want to provide a custom list of changes for your initial release. Changes supports this, allowing you to replace the list of changes for any release specified a simple YAML file:
|
|
92
|
+
|
|
93
|
+
1. Create a YAML file containing the releases you want to change. For example,
|
|
94
|
+
```yaml
|
|
95
|
+
"1.0.0":
|
|
96
|
+
- "feat: Initial release"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
2. Pass this alternative history file to any changes command:
|
|
100
|
+
|
|
101
|
+
```sh
|
|
102
|
+
changes notes --history history.yaml
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
> [!NOTE]
|
|
106
|
+
>
|
|
107
|
+
> Changes replaces all the changes in the named releases with those listed in the YAML file; you will need to manually include any change you want listed for releases you override.
|
|
108
|
+
|
|
88
109
|
## Development
|
|
89
110
|
|
|
90
111
|
### Setup
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Changes
|
|
2
2
|
|
|
3
3
|
[](https://github.com/jbmorley/changes/actions/workflows/build.yaml)
|
|
4
4
|
|
|
@@ -74,6 +74,26 @@ Or see the details of specific sub-commands by passing the `--help` flag directl
|
|
|
74
74
|
changes release --help
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
+
### Alternative Histories
|
|
78
|
+
|
|
79
|
+
Sometimes you might need to provide your own list of changes for specific releases—this can be helpful if you forgot to adhere to Conventional Commits or, perhaps, you want to provide a custom list of changes for your initial release. Changes supports this, allowing you to replace the list of changes for any release specified a simple YAML file:
|
|
80
|
+
|
|
81
|
+
1. Create a YAML file containing the releases you want to change. For example,
|
|
82
|
+
```yaml
|
|
83
|
+
"1.0.0":
|
|
84
|
+
- "feat: Initial release"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
2. Pass this alternative history file to any changes command:
|
|
88
|
+
|
|
89
|
+
```sh
|
|
90
|
+
changes notes --history history.yaml
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
> [!NOTE]
|
|
94
|
+
>
|
|
95
|
+
> Changes replaces all the changes in the named releases with those listed in the YAML file; you will need to manually include any change you want listed for releases you override.
|
|
96
|
+
|
|
77
97
|
## Development
|
|
78
98
|
|
|
79
99
|
### Setup
|
|
@@ -31,11 +31,10 @@ import subprocess
|
|
|
31
31
|
import sys
|
|
32
32
|
import tempfile
|
|
33
33
|
|
|
34
|
+
import fastcommand
|
|
34
35
|
import jinja2
|
|
35
36
|
import yaml
|
|
36
37
|
|
|
37
|
-
from . import cli
|
|
38
|
-
|
|
39
38
|
|
|
40
39
|
CHANGES_DIRECTORY = os.path.dirname(os.path.abspath(__file__))
|
|
41
40
|
TEMPLATES_DIRECTORY = os.path.join(CHANGES_DIRECTORY, "templates")
|
|
@@ -402,9 +401,6 @@ class Release(object):
|
|
|
402
401
|
def is_initial_development(self):
|
|
403
402
|
return self.version.is_initial_development
|
|
404
403
|
|
|
405
|
-
def merge(self, release):
|
|
406
|
-
self.changes.extend(release.changes)
|
|
407
|
-
|
|
408
404
|
@property
|
|
409
405
|
def sections(self):
|
|
410
406
|
return group_changes(self.changes)
|
|
@@ -511,7 +507,7 @@ class History(object):
|
|
|
511
507
|
if self.history is not None:
|
|
512
508
|
for version, release in load_history(path=self.history, prefix=self.scope).items():
|
|
513
509
|
try:
|
|
514
|
-
releases_by_version[version].
|
|
510
|
+
releases_by_version[version].changes = release.changes
|
|
515
511
|
except KeyError:
|
|
516
512
|
releases_by_version[version] = release
|
|
517
513
|
|
|
@@ -686,11 +682,11 @@ def assert_is_repository(path):
|
|
|
686
682
|
path = parent
|
|
687
683
|
|
|
688
684
|
|
|
689
|
-
@
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
685
|
+
@fastcommand.command("version", help="output the current version as determined by taking the the most recent version tag and applying any subsequent changes; if there have been no changes since the most recent version tag, this will output the version of the most recent tag", arguments=[
|
|
686
|
+
fastcommand.Argument("--scope", help="scope to be used in tags and commit messages"),
|
|
687
|
+
fastcommand.Argument("--released", action="store_true", default=False, help="scope to be used in tags and commit messages"),
|
|
688
|
+
fastcommand.Argument("--pre-release", action="store_true", default=False, help="generate a pre-release version"),
|
|
689
|
+
fastcommand.Argument("--pre-release-prefix", type=str, default="rc", help="prefix to be used when generating a pre-release version (defaults to 'rc')"),
|
|
694
690
|
])
|
|
695
691
|
def command_version(options):
|
|
696
692
|
path = os.getcwd()
|
|
@@ -703,17 +699,17 @@ def command_version(options):
|
|
|
703
699
|
print(history.releases[0].version)
|
|
704
700
|
|
|
705
701
|
|
|
706
|
-
@
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
702
|
+
@fastcommand.command("release", help="tag the commit as a new release", formatter_class=argparse.RawDescriptionHelpFormatter, arguments=[
|
|
703
|
+
fastcommand.Argument("--scope", help="scope to be used in tags and commit messages"),
|
|
704
|
+
fastcommand.Argument("--skip-if-empty", action="store_true", default=False, help="exit cleanly if there are no changes to release"),
|
|
705
|
+
fastcommand.Argument("--command", help="additional command to run during the release; if the command fails, the release will be rolled back (cannot be used alongside --exec)"),
|
|
706
|
+
fastcommand.Argument("--exec", help="executable to run to during the release; if the executable fails, the release will be rolled back (cannot be used alongside --command)"),
|
|
707
|
+
fastcommand.Argument("--push", action="store_true", default=False, help="push the newly created tag"),
|
|
708
|
+
fastcommand.Argument("--dry-run", action="store_true", default=False, help="perform a dry run, only logging the operations that would be performed"),
|
|
709
|
+
fastcommand.Argument("--template", help="custom Jinja2 template"),
|
|
710
|
+
fastcommand.Argument("--pre-release", action="store_true", default=False, help="generate a pre-release version"),
|
|
711
|
+
fastcommand.Argument("--pre-release-prefix", type=str, default="rc", help="prefix to be used when generating a pre-release version (defaults to 'rc')"),
|
|
712
|
+
fastcommand.Argument("arguments", nargs="*", help="arguments to pass to the release command"),
|
|
717
713
|
], epilog="""
|
|
718
714
|
When calling a script specified by `--command` or `--exec`, Changes defines a number of environment variables:
|
|
719
715
|
|
|
@@ -841,15 +837,15 @@ class AbsolutePathLoader(jinja2.BaseLoader):
|
|
|
841
837
|
return source, path, lambda: mtime == os.path.getmtime(path)
|
|
842
838
|
|
|
843
839
|
|
|
844
|
-
@
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
840
|
+
@fastcommand.command("notes", help="output the release notes", arguments=[
|
|
841
|
+
fastcommand.Argument("--scope", help="filter the release notes to the given scope"),
|
|
842
|
+
fastcommand.Argument("--skip-unreleased", action="store_true", help="skip unreleased versions"),
|
|
843
|
+
fastcommand.Argument("--history", help="file containing changes for versions not adhereing to Conventional Commits"),
|
|
844
|
+
fastcommand.Argument("--released", action="store_true", default=False, help="show only released versions; display the most recent released version, or all versions if the '--all' flag is specified"),
|
|
845
|
+
fastcommand.Argument("--pre-release", action="store_true", default=False, help="include pre-release versions"),
|
|
846
|
+
fastcommand.Argument("--pre-release-prefix", type=str, default="rc", help="prefix to be used when generating a pre-release version (defaults to 'rc')"),
|
|
847
|
+
fastcommand.Argument("--all", action="store_true", default=False, help="output release notes for all versions"),
|
|
848
|
+
fastcommand.Argument("--template", help="custom Jinja2 template")
|
|
853
849
|
])
|
|
854
850
|
def command_notes(options):
|
|
855
851
|
path = os.getcwd()
|
|
@@ -872,7 +868,7 @@ def command_notes(options):
|
|
|
872
868
|
print(format_notes(releases=[history.releases[0]], template=template), end="")
|
|
873
869
|
|
|
874
870
|
|
|
875
|
-
@
|
|
871
|
+
@fastcommand.command("scopes", help="show all the unique scopes used within the repository")
|
|
876
872
|
def command_scopes(options) -> None:
|
|
877
873
|
path = os.getcwd()
|
|
878
874
|
assert_is_repository(path)
|
|
@@ -898,10 +894,10 @@ You can find out more about Conventional Commits and Semantic Versioning at the
|
|
|
898
894
|
def main():
|
|
899
895
|
verbose = '--verbose' in sys.argv[1:] or '-v' in sys.argv[1:]
|
|
900
896
|
logging.basicConfig(level=logging.DEBUG if verbose else logging.INFO, format="[%(levelname)s] %(message)s")
|
|
901
|
-
parser =
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
897
|
+
parser = fastcommand.CommandParser(prog="changes",
|
|
898
|
+
description=DESCRIPTION,
|
|
899
|
+
epilog=EPILOG,
|
|
900
|
+
formatter_class=argparse.RawDescriptionHelpFormatter)
|
|
905
901
|
parser.add_argument('--verbose', '-v', action='store_true', default=False, help="show verbose output")
|
|
906
902
|
if "--scope" in sys.argv:
|
|
907
903
|
parser.add_argument("--scope", dest="legacy_scope", help="scope to be used in tags and commit messages")
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: changes-semver
|
|
3
|
-
Version: 6.0.
|
|
3
|
+
Version: 6.0.7
|
|
4
4
|
Author-email: Jason Morley <hello@jbmorley.co.uk>
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
7
7
|
License-File: LICENSE
|
|
8
|
+
Requires-Dist: fastcommand
|
|
8
9
|
Requires-Dist: jinja2
|
|
9
10
|
Requires-Dist: pyyaml
|
|
10
11
|
Dynamic: license-file
|
|
11
12
|
|
|
12
|
-
#
|
|
13
|
+
# Changes
|
|
13
14
|
|
|
14
15
|
[](https://github.com/jbmorley/changes/actions/workflows/build.yaml)
|
|
15
16
|
|
|
@@ -85,6 +86,26 @@ Or see the details of specific sub-commands by passing the `--help` flag directl
|
|
|
85
86
|
changes release --help
|
|
86
87
|
```
|
|
87
88
|
|
|
89
|
+
### Alternative Histories
|
|
90
|
+
|
|
91
|
+
Sometimes you might need to provide your own list of changes for specific releases—this can be helpful if you forgot to adhere to Conventional Commits or, perhaps, you want to provide a custom list of changes for your initial release. Changes supports this, allowing you to replace the list of changes for any release specified a simple YAML file:
|
|
92
|
+
|
|
93
|
+
1. Create a YAML file containing the releases you want to change. For example,
|
|
94
|
+
```yaml
|
|
95
|
+
"1.0.0":
|
|
96
|
+
- "feat: Initial release"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
2. Pass this alternative history file to any changes command:
|
|
100
|
+
|
|
101
|
+
```sh
|
|
102
|
+
changes notes --history history.yaml
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
> [!NOTE]
|
|
106
|
+
>
|
|
107
|
+
> Changes replaces all the changes in the named releases with those listed in the YAML file; you will need to manually include any change you want listed for releases you override.
|
|
108
|
+
|
|
88
109
|
## Development
|
|
89
110
|
|
|
90
111
|
### Setup
|
|
@@ -990,7 +990,7 @@ fi
|
|
|
990
990
|
- Foo
|
|
991
991
|
""")
|
|
992
992
|
|
|
993
|
-
def
|
|
993
|
+
def test_notes_additional_history_overrides_changes(self):
|
|
994
994
|
with Repository() as repository:
|
|
995
995
|
repository.perform([
|
|
996
996
|
EmptyCommit("initial commit"),
|
|
@@ -1011,7 +1011,6 @@ fi
|
|
|
1011
1011
|
|
|
1012
1012
|
- Baz
|
|
1013
1013
|
- Bar
|
|
1014
|
-
- New and exciting
|
|
1015
1014
|
|
|
1016
1015
|
**Fixes**
|
|
1017
1016
|
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
# Copyright (c) 2021-2026 Jason Morley
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
22
|
-
|
|
23
|
-
import argparse
|
|
24
|
-
import functools
|
|
25
|
-
import logging
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
COMMANDS = {}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
class Command(object):
|
|
32
|
-
|
|
33
|
-
def __init__(self, name, help, arguments, epilog, formatter_class, callback):
|
|
34
|
-
self.name = name
|
|
35
|
-
self.help = help
|
|
36
|
-
self.arguments = arguments
|
|
37
|
-
self.epilog = epilog
|
|
38
|
-
self.formatter_class = formatter_class
|
|
39
|
-
self.callback = callback
|
|
40
|
-
|
|
41
|
-
class Argument(object):
|
|
42
|
-
|
|
43
|
-
def __init__(self, *args, **kwargs):
|
|
44
|
-
self.args = args
|
|
45
|
-
self.kwargs = kwargs
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
def command(name, help="", arguments=[], epilog=None, formatter_class=argparse.HelpFormatter):
|
|
49
|
-
def wrapper(fn):
|
|
50
|
-
@functools.wraps(fn)
|
|
51
|
-
def inner(*args, **kwargs):
|
|
52
|
-
return fn(*args, **kwargs)
|
|
53
|
-
COMMANDS[name] = Command(name, help, arguments, epilog, formatter_class, inner)
|
|
54
|
-
return inner
|
|
55
|
-
return wrapper
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
class CommandParser(object):
|
|
59
|
-
|
|
60
|
-
def __init__(self, *args, **kwargs):
|
|
61
|
-
self.parser = argparse.ArgumentParser(*args, **kwargs)
|
|
62
|
-
subparsers = self.parser.add_subparsers(help="command")
|
|
63
|
-
for name, command in COMMANDS.items():
|
|
64
|
-
subparser = subparsers.add_parser(command.name,
|
|
65
|
-
help=command.help,
|
|
66
|
-
epilog=command.epilog,
|
|
67
|
-
formatter_class=command.formatter_class)
|
|
68
|
-
for argument in command.arguments:
|
|
69
|
-
subparser.add_argument(*(argument.args), **(argument.kwargs))
|
|
70
|
-
subparser.set_defaults(fn=command.callback)
|
|
71
|
-
|
|
72
|
-
def add_argument(self, *args, **kwargs):
|
|
73
|
-
self.parser.add_argument(*args, **kwargs)
|
|
74
|
-
|
|
75
|
-
def run(self):
|
|
76
|
-
options = self.parser.parse_args()
|
|
77
|
-
if 'fn' not in options:
|
|
78
|
-
logging.error("No command specified.")
|
|
79
|
-
exit(1)
|
|
80
|
-
options.fn(options)
|
|
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
|