kenaco / auto-changelog Goto Github PK
View Code? Open in Web Editor NEWA small program that will generate a changelog from git repos using "conventional style" commit messages
License: MIT License
A small program that will generate a changelog from git repos using "conventional style" commit messages
License: MIT License
New python is out, let's support it.
Add support for:
--release-summary # display tagged commit message body as release summary
TODO:
DoD: PR is approved and merged to master.
Component | Version |
---|---|
auto-changelog | 0.5.1 |
Python | 3.8.5 |
Operating System | Windows 10 Pro 64 bits |
auto-changelog does not process correctly commits which contain empty additional commit body.
I am using github online interface to merge my pull requests into master. I am using the squash merging option.
Github is automatically putting a double \n\n
at the end of the commit message.
I would be cool if auto-changelog supports this behaviour.
Input
commit 11ff580ecf30303d371af146e6e67195e44e6078
Author: Fabien Hermitte <[email protected]>
Date: Thu Aug 20 00:12:01 2020 +0200
fix(test): fix bug where tests were not found !youpy! (#46)
Observed ouput
DEBUG:repository.generate_changelog:Adding commit 0ffc71a with attributes ('0ffc71a29a385f75f2d59856cdd3f74ae5473f86', '', '', '', '', '')
DEBUG:repository.generate_changelog:Found commit 11ff580
DEBUG:repository._parse_conventional_commit:Commit message did not match expected pattern: fix(test): fix bug where tests were not found !youpy! (#46)
Build some CI pipeline
This is my goal, since I start maintaining project. Implement same API and feature set. And maybe something extra later.
npm's auto-changelog: https://www.npmjs.com/package/auto-changelog
TODO:
I'm not happy about the current state of testing.
We have some unit tests. No integration(functional, e2e, depends on naming you want to use) tests. No test coverage measurement. No code quality analysis.
With the growing number of features, this will be a problem soon.
So my goal is to improve these things and learn more about testing in the process.
I have an unsual project layout of the github repo:
and when i run auto-changelog inside the python folder i get:
$ auto-changelog --starting-commit 98f8a7d2a8285f0bce5ba67815f07da8924227f1
Traceback (most recent call last):
File "/Users/klay6683/miniconda3/envs/py37/bin/auto-changelog", line 10, in <module>
sys.exit(main())
File "/Users/klay6683/miniconda3/envs/py37/lib/python3.7/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/Users/klay6683/miniconda3/envs/py37/lib/python3.7/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/Users/klay6683/miniconda3/envs/py37/lib/python3.7/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/klay6683/miniconda3/envs/py37/lib/python3.7/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/Users/klay6683/miniconda3/envs/py37/lib/python3.7/site-packages/auto_changelog/__main__.py", line 56, in main
repository = GitRepository(repo, latest_version=latest_version, skip_unreleased=not unreleased)
File "/Users/klay6683/miniconda3/envs/py37/lib/python3.7/site-packages/auto_changelog/repository.py", line 14, in __init__
self.repository = Repo(repository_path)
File "/Users/klay6683/miniconda3/envs/py37/lib/python3.7/site-packages/git/repo/base.py", line 183, in __init__
raise InvalidGitRepositoryError(epath)
git.exc.InvalidGitRepositoryError: /Users/klay6683/Dropbox/src/heat1d/python
can it be made so that it works inside the python
subfolder and only creates a CHANGELOG.md there?
When no tags are present, it throws an IndexError
and prints a stack trace.
Traceback (most recent call last):
File "/home/michael/.virtualenvs/cheesecake_kwalitee_index/bin/auto-changelog", line 11, in <module>
sys.exit(main())
File "/home/michael/.virtualenvs/cheesecake_kwalitee_index/lib/python3.5/site-packages/auto_changelog/__main__.py", line 45, in main
tags, unreleased = traverse(args['--repo'])
File "/home/michael/.virtualenvs/cheesecake_kwalitee_index/lib/python3.5/site-packages/auto_changelog/parser.py", line 57, in traverse
left_overs = group_commits(wrapped_tags, commits)
File "/home/michael/.virtualenvs/cheesecake_kwalitee_index/lib/python3.5/site-packages/auto_changelog/parser.py", line 36, in group_commits
left_overs = list(filter(lambda c: c.date > tags[-1].date, commits))
File "/home/michael/.virtualenvs/cheesecake_kwalitee_index/lib/python3.5/site-packages/auto_changelog/parser.py", line 36, in <lambda>
left_overs = list(filter(lambda c: c.date > tags[-1].date, commits))
IndexError: list index out of range
Add support for:
--merge-pattern [regex] # add custom regex pattern for merge commits
TODO:
DoD: PR is approved and merged to master.
could the gitpython dependency be updated? conda-forge is at 3.1.x by now, and installing this via pypi clobbers my conda packages by simply removing the conda package and replacing it with the old 2.1.x version.
thanks for your consideration!
Add: -V, --version # output the version number
Output script package version.
Hi.
I'm following the conventional commits guidelines like
git log --oneline
dd8baa9 (HEAD -> master, origin/master) chore(release): 0.3.1
9d04450 fix: move versioning tools to dev dependencies
9925875 chore(release): 0.3.0
e5df24a feat: decompile LUA (using unluac tool)
2805e82 improvement: descriptive CLI progress messages
9394a7c refactor: move unpack functionality to the Cartridge method
a125ff6 chore(release): 0.2.1
e0d3406 feat: semantic versioning tools
fc8e45c feat: unpack GWC to LUAC (+media)
888a821 feat: ByteReader Read bytes of a given file.
f1ed153 feat: a CLI endpoint
32c9347 perf: lock the python dependency versions
8960f27 fix(ci): add poetry to PATH
78b0f0f ci: gitlab pipeline to test and lint
61118a4 improvement: pass tests and lint requirements
cd7b3e1 chore: add licensing
6006543 feat: environment creation routine
8c619cd chore: initial repository outline
with tagged release commits v0.3.1
, etc in between.
However, auto-changelog
puts everything under one single (latest) release
...
You can find the source code itself at https://gitlab.com/pziaukas/AntiWherigo .
I would like to use this module from a Python script but I can't access to the main
function.
I thought write quickly a script that uses bumpversion et follows the Conventional Commits convention to release my project but I'll have to do so using bash
.
I didn't find anything like this on the Internet. I can't believe it... I have missed it... ๐ค
Add support for:
--ignore-commit-pattern [regex] # pattern to ignore when parsing commits
TODO:
DoD: PR is approved and merged to master.
Add limits for displayed commits per release:
-l, --commit-limit [count] # number of commits to display per release, default: 3
TODO:
Observe original implementation, comment examples, and differences.
Prepare tests
Implement solution
Send PR
DoD: PR is approved and merged to master.
Hi,
this project is not as active as it can be.
So I think if you won't mind to pass project to other maintainer.
I would be glad to take maintenance of this project, fix bugs and improve it.
If there's a commit message with unsupported type, like 'version:', an ValueError would be raised and the program got crashed.
Error message like below:
ValueError: 'version' is not a valid ChangeType
However, according to the Conventional Commits 1.0.0-beta.4,
commit types other than fix: and feat: are allowed, for example @commitlint/config-conventional (based on the the Angular convention)
recommends chore:, docs:, style:, refactor:, perf:, test:, and others.
Therefore, an user defined message type should not cause a crash, so does an typo. It's better to just ignore it.
I forked your project and added some new features that I was wondering if you'd like merged back.
-a --assume foo - instead of Unreleased, assume the version will be foo
-n --new - only emit new (e.g. Unreleased) changes (will honor the version set by -a)
-b - also emit the body per Conventional Commit standards
-f - also emit the footer per Conventional Commit standards
The use case for the above was "As a developer, I want to be able to generate a brief set of changes to add to my release tag as well as a full set of changes for my change log, all from the conventional commit messages in my git commits". This was to support using auto-changelog as part of my CI/CD pipeline.
Full changes for CHANGELOG.md release v1.2.3
auto-changelog -a v1.2.3 -b -f
Incremental changes (e.g. to merge into an existing changelog where I didn't always use conventional commits):
cat <(auto-changelog -a v1.2.3 -b -f -n -o /dev/stdout)
CHANGELOG.md > tmp.md && mv tmp.md CHANGELOG.md`
Brief changes for a commit tag for release v1.2.3:
auto-changelog -a v1.2.3 -n -o /dev/stdout | git tag --file="-" v1.2.3
So a simple CI/CD release pipeline would be to do one of the first two, commit that, then do the third.
TODO:
Good job!
auto-changelog will leak credentials if they are stored in .git/config
. auto-changelog uses the remote url stored in .git/config
to create the diff url.
.git/config
[remote "origin"] url = https://<USERNAME>:<TOKEN>@github.com/myname/myrepo
will result to the following url in the generated changelog:
CHANGELOG.md
... Full set of changes: [`0.1.0...0.2.0`](https://<USERNAME>:<TOKEN>@github.com/myname/myrepo/compare/0.1.0...0.2.0) ...
Most code hosting providers allow basic authentication for Git-over-HTTP with credentials encoded in th url.
Examples:
https://USERNAME:[email protected]/myname/myrepo
https://[email protected]/myname/myrepo
https://USERNAME:[email protected]/myname/myrepo
While it is in general a bad idea to use those urls for cloning a repository, it is still possible and the credentials will be stored unencrypted in the .git/config
.
Add support for multiple templates:
-t, --template [template] # specify template to use [compact, keepachangelog, json], default: compact
TODO:
DoD: PR is approved and merged to master.
This useful repo seems not maintained anymore. Too bad to still lose commits 1 year after a fix was proposed.
As is shown above, the auto-changelog
iterates commits from master
towards the first commit, ignoring the commits hadn't been merged into master branch.
But according to the git flow, the commits in master branch are in released status, therefore, it could never generate Unreleased
changelog logically. For projects using git flow, it's better to providing an option to specifying which revision to iterate from.
From my point of view, it's better to iter from the current branch's HEAD, so that every contributors can generate their unreleased contributions and mantainers can generate full changelog during the release process.
It looks like if a tag is attached to a particular commit, that commit is being excluded from the generated changelog.
My changelogs are currently empty using 0.5.0, while they were fine with 0.4.x.
No error messages either.
Add support for:
--tag-pattern [regex] # override regex pattern for version tags
TODO:
DoD: PR is approved and merged to master.
I created a project with no remote repository, with a first version tag "v0.1.0" and ran auto-changelog --tag-prefix=v
to generate the CHANGELOG.md
file. It worked fine and just warns me with:
ERROR:root:Remote named 'origin' didn't exist. Turning off issue links.
ERROR:root:Remote named 'origin' didn't exist. Turning off compare url links.
After a few commits, I add a new version tag "v0.2.0" but when I run the command again to update the changelog I get the following trace:
ERROR:root:Remote named 'origin' didn't exist. Turning off issue links.
ERROR:root:Remote named 'origin' didn't exist. Turning off compare url links.
Traceback (most recent call last):
File "C:\Users\laure\.pyenv\pyenv-win\versions\3.7.6-amd64\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\laure\.pyenv\pyenv-win\versions\3.7.6-amd64\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "D:\projects\c2ba_sandbox\my_addon\.venv\Scripts\auto-changelog.exe\__main__.py", line 9, in <module>
File "d:\projects\c2ba_sandbox\my_addon\.venv\lib\site-packages\click\core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "d:\projects\c2ba_sandbox\my_addon\.venv\lib\site-packages\click\core.py", line 782, in main
rv = self.invoke(ctx)
File "d:\projects\c2ba_sandbox\my_addon\.venv\lib\site-packages\click\core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "d:\projects\c2ba_sandbox\my_addon\.venv\lib\site-packages\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "d:\projects\c2ba_sandbox\my_addon\.venv\lib\site-packages\auto_changelog\__main__.py", line 89, in main
stopping_commit=stopping_commit,
File "d:\projects\c2ba_sandbox\my_addon\.venv\lib\site-packages\auto_changelog\__init__.py", line 10, in generate_changelog
changelog = repository.generate_changelog(*args, **kwargs)
File "d:\projects\c2ba_sandbox\my_addon\.venv\lib\site-packages\auto_changelog\repository.py", line 79, in generate_changelog
releases[release_index].set_compare_url(diff_url, releases[release_index + 1].title)
File "d:\projects\c2ba_sandbox\my_addon\.venv\lib\site-packages\auto_changelog\domain_model.py", line 157, in set_compare_url
self.diff_url = diff_url.format(previous=previous_tag, current=self.tag)
AttributeError: 'NoneType' object has no attribute 'format'
So it seems the second time the "turning off ***" does not work.
It is probably a minor issue since the common use case is to have a remote repository. If I had one everything works fine.
Add support for:
--tag-prefix [prefix] # prefix used in version tags, default: v
TODO:
DoD: PR is approved and merged to master.
Add support for package:
-p, --package # use version from package.json as latest release
Questions:
TODO:
DoD: PR is approved and merged to master.
In a nutshell:
This should be more linear workflow than currently used algorithm.
Also we can use improvements related to #12
The latest version of gitpython
dependency drops sub-dependencies on ddt
and gitdb
.
- Updating gitpython (2.1.12 -> 2.1.13)
- Removing ddt (1.2.1)
- Removing gitdb (0.6.4)
However, your package imports gitdb
directly and, as a consequence, fails.
Traceback (most recent call last):
File ".../lib/python3.7/site-packages/git/__init__.py", line 25, in _init_externals
import gitdb
ModuleNotFoundError: No module named 'gitdb'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File ".../bin/auto-changelog", line 6, in <module>
from auto_changelog.__main__ import main
File ".../lib/python3.7/site-packages/auto_changelog/__main__.py", line 26, in <module>
from .parser import group_commits, traverse
File ".../lib/python3.7/site-packages/auto_changelog/parser.py", line 7, in <module>
import git
File ".../lib/python3.7/site-packages/git/__init__.py", line 33, in <module>
_init_externals()
File ".../lib/python3.7/site-packages/git/__init__.py", line 27, in _init_externals
raise ImportError("'gitdb' could not be found in your PYTHONPATH")
ImportError: 'gitdb' could not be found in your PYTHONPATH
DoD: pytest is set-up, to run some tests
Maybe it would be nice to have some --debug
flag that prints a more verbose flow of internal information. Would be helpful to know what's going on and debug certain issues.
I got this error when I try to run the command auto-changelog
:
TypeError: PackingType of packed-Refs not understood: '# pack-refs with: peeled fully-peeled sorted'
The fact is, the plugin already worked on this project. Moreover, I have another project with same versions of Python, Git and auto-changelog and it works.
I don't understand the "packed-refs" things. I guess it's something from Git. The repo was deleted, the virtualenv completly uninstalled/reinstalled and the repo cloned again.
I got the same error. So it was not local durty Git refs...
I opened an issue here because didn't found anything anywhere else.
Full Stacktrace:
Traceback (most recent call last):
File "/Users/mason/.pyenv/versions/my-project/bin/auto-changelog", line 11, in
sys.exit(main())
File "/Users/mason/.pyenv/versions/2.7.14/envs/my-project/lib/python2.7/site-packages/auto_changelog/main.py", line 46, in main
tags, unreleased = traverse(args['--repo'])
File "/Users/mason/.pyenv/versions/2.7.14/envs/my-project/lib/python2.7/site-packages/auto_changelog/parser.py", line 42, in traverse
tags = repo.tags
File "/Users/mason/.pyenv/versions/2.7.14/envs/my-project/lib/python2.7/site-packages/git/repo/base.py", line 352, in tags
return TagReference.list_items(self)
File "/Users/mason/.pyenv/versions/2.7.14/envs/my-project/lib/python2.7/site-packages/git/util.py", line 942, in list_items
out_list.extend(cls.iter_items(repo, *args, **kwargs))
File "/Users/mason/.pyenv/versions/2.7.14/envs/my-project/lib/python2.7/site-packages/git/refs/symbolic.py", line 609, in _iter_items
for sha, rela_path in cls._iter_packed_refs(repo): # @unusedvariable
File "/Users/mason/.pyenv/versions/2.7.14/envs/my-project/lib/python2.7/site-packages/git/refs/symbolic.py", line 100, in _iter_packed_refs
raise TypeError("PackingType of packed-Refs not understood: %r" % line)
TypeError: PackingType of packed-Refs not understood: '# pack-refs with: peeled fully-peeled sorted'
Do you have any idea?
Hi!
I like the looks of this project.
I tried to install it with
git clone https://github.com/Michael-F-Bryan/auto-changelog.git
cd auto-changelog/
pip install .
but it didn't work. I realized there is no setup.py
, because you are using poetry
.
My guess is that you don't want to maintain both type of installation procedures, right?
Ok, I admit it. I leave mess in repos code. I'll fix it.
I created this issue to create a somehow common channel to communicate and handle discussions and announcements about whole project.
I consider CICD as today's standard.
Add support for:
-b, --backfill-limit [count] # number of commits to backfill empty releases with, default: 3
TODO:
DoD: PR is approved and merged to master.
I'm trying out the tool and it looks pretty nice.
However, I'm a bit confused about the matching of conventional commit message pattern <type>(<scope>): <subject>
. Why does auto-changelog match scopes only for certain types?
For example, some of my last commit messages may look like this:
chore(release): 0.2.0
feat(CLI): ability to select language
feat: genetic optimisation algorithm
which results in a changelog
So why does it display "[release] 0.2.0" and not "[CLI] ability to select language"?
Add support for:
--breaking-pattern [regex] # regex pattern for breaking change commits
TODO:
DoD: PR is approved and merged to master.
Source: https://www.npmjs.com/package/auto-changelog
Relates to #57
Add support for:
--sort-commits [property] # sort commits by property [relevance, date, date-desc], default: relevance
TODO:
DoD: PR is approved and merged to master.
Hello !
I have a proposition concerning the default template of the issue url.
With the current version we got:
[#19](https://github.com/Michael-F-Bryan/auto-changelog/issues)
With this url when we are clicking on the link, we get the home page of the issues of the repo.
I don't think this is really what we are looking for because #19
is a specific issue that I would like to see by clicking on this link.
From the documentation, we can change this behaviour by using the following parameter
--issue-url https://github.com/Michael-F-Bryan/auto-changelog/issues/{id}
And then we get:
[#19](https://github.com/Michael-F-Bryan/auto-changelog/issues/19)
This time when we are clicking on the link, we get to see the specific issue (#19
)
In my opinion, by default we should get by default the id
at the end of the URL.
No need to specify a --issue-url
parameter for that.
The change is quick simple in the function _issue_from_git_remote_url
we should have:
return urljoin(url + '/', "issues/{id}")
I can do a PR to do this change if needed.
Waiting, to have your opinion !
Thanks ๐
Watching your simple example video, I tried the examples given there, but nothing happens:
auto-changelog --unreleased
Usage: auto-changelog [options]
or
auto-changelog --latest-version 0.1.6
Usage: auto-changelog [options]
I installed auto-changelog via pip, version 0.1.7.
Component | Version |
---|---|
auto-changelog | 0.5.1 |
Python | 3.8 |
Operating System | Ubuntu 16.04.2 LTS (Xenial Xerus) |
auto-changelog does not process correctly commits which contain multiline bodies or footers.
A commit which contains a multiline body will be ignored by auto-changelog.
commit d912d6c97cefe38a3fe0e5933dc9bd9ea77fa7b0
Author: John Doe <john.doe@email>
Date: Thu Aug 6 11:11:35 2020 +0200
feat: Add file #1
Body line 1
Body line 2
# Changelog
## Unreleased (2020-08-06)
# Changelog
## Unreleased (2020-08-06)
#### New Features
* Add file #1
@pytest.mark.parametrize(
"commands",
[["touch file", "git add file", "git commit -m 'feat: Add file #1\n\nBody line 1\nBody line 2' -q", "git log"]],
)
def test_double_line_body(test_repo, runner, open_changelog):
result = runner.invoke(main, ["--unreleased"])
assert result.exit_code == 0, result.stderr
assert result.output == ""
changelog = open_changelog().read()
print(changelog)
assert "Add file #1" in changelog
When "fixing" markdown template, forget to run tests and break almost all of them.
I use Poetry on couple of other projects and it's great.
First of all, thank you for this amazing app. I've tried using auto-changelog on other branches but It got failed. Is there a way to run this app for other branches rather than Master.
Best Regards
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.