Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT: Add configuration files #55

Merged
merged 23 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c6ee5d6
feat: Add bump option (CLI, library) allowing to specify an exact ver…
TheoGoudout Aug 21, 2023
1b3b0db
sty: run ruff --fix
oesteban Aug 18, 2023
d724604
fix: move toml as a dependency
oesteban Aug 18, 2023
159bea8
fix: replace double backticks with single
oesteban Aug 21, 2023
d2a9387
fix(docs): revise docstring default value
oesteban Aug 21, 2023
d91a764
fix: revise config file reading function
oesteban Aug 21, 2023
612d3ed
fix(docs): several documentation issues
oesteban Aug 21, 2023
e8ecd9b
feat: infer config file depending on platform with appdirs
oesteban Aug 21, 2023
389bd92
fix: remove _Sentinel class
oesteban Aug 21, 2023
f36d1fb
fix: do not interpret ``None`` in config files
oesteban Aug 21, 2023
89a1af3
sty: roll back multiline string
oesteban Aug 21, 2023
a99dd21
Merge remote-tracking branch 'upstream/main' into feat/config-files
oesteban Aug 21, 2023
d97d033
maint: pacify mypy type checking
oesteban Aug 21, 2023
4990bdd
fix: sloppy merge leftovers
oesteban Aug 21, 2023
cbaf5e8
fix: the second parser also needs the arguments
oesteban Aug 21, 2023
20d20e2
fix: roll deprecation warning back
oesteban Aug 21, 2023
eec730b
fix: better handling of warnings in deprecation of --bump-latest
oesteban Aug 21, 2023
3f38e6a
Update tests/test_cli.py
pawamoy Aug 21, 2023
21599f7
Apply suggestions from code review
pawamoy Aug 21, 2023
9d9a0bc
Merge branch 'main' into feat/config-files
pawamoy Aug 21, 2023
cefec7f
tests: Restore CWD after changing it
pawamoy Aug 21, 2023
481baca
style: Format
pawamoy Aug 21, 2023
204b308
fix(docs): version regex in usage examples
oesteban Aug 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,70 @@ Other options can be used to help *git-changelog* retrieving
the latest entry from your changelog: `--version-regex`
and `--marker-line`.


## Configuration files

Project-wise, permanent configuration of *git-changelog* is possible.
By default, *git-changelog* will search for the existence a suitable configuration
in the `pyproject.toml` file or otherwise, the following configuration files
in this particular order:
* `.git-changelog.toml`
* `config/git-changelog.toml`
* `.config/git-changelog.toml`
* `<current-user-config-path>/git-changelog.toml`
pawamoy marked this conversation as resolved.
Show resolved Hide resolved

In the last case (`<current-user-config-path>/git-changelog.toml`), the `<current-user-config-path>`
is platform-dependent and will be automatically inferred from your settings.
In Unix systems, this will typically point at `$HOME/.config/git-changelog.toml`.
The use of a configuration file can be disabled or overridden with the `--config-file`
option.
To disable the configuration file, pass `no`, `none`, `false`, `off`, `0` or empty string (`''`):

```bash
git-changelog --config-file no
```

To override the configuration file, pass the path to the new file:

```bash
git-changelog --config-file $HOME/.custom-git-changelog-config
```

The configuration file must be written in TOML language, and may take values
for most of the command line options:

```toml
bump = "auto"
convention = 'basic'
in-place = false
marker-line = '<!-- insertion marker -->'
output = 'output.log'
parse-refs = false
parse-trailers = false
repository = '.'
sections = ['fix', 'maint']
template = 'angular'
version-regex = '^## \[(?P<version>v?[^\]]+)'
pawamoy marked this conversation as resolved.
Show resolved Hide resolved
```

In the case of configuring *git-changelog* within `pyproject.toml`, these
settings must be found in the appropriate section:

```toml
[tool.git-changelog]
bump = "minor"
convention = 'conventional'
in-place = false
marker-line = '<!-- insertion marker -->'
output = 'output.log'
parse-refs = false
parse-trailers = false
repository = '.'
sections = 'fix,maint'
template = 'keepachangelog'
version-regex = '^## \[(?P<version>v?[^\]]+)'
pawamoy marked this conversation as resolved.
Show resolved Hide resolved
```

[keepachangelog]: https://keepachangelog.com/en/1.0.0/
[conventional-commit]: https://www.conventionalcommits.org/en/v1.0.0-beta.4/
[jinja]: https://jinja.palletsprojects.com/en/3.1.x/
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ classifiers = [
"Typing :: Typed",
]
dependencies = [
"appdirs",
"Jinja2>=2.10,<4",
"semver>=2.13",
"toml>=0.10",
]

[project.urls]
Expand Down Expand Up @@ -77,7 +79,6 @@ docs = [
"mkdocs-material>=7.3",
"mkdocs-minify-plugin>=0.6.4",
"mkdocstrings[python]>=0.18",
"toml>=0.10",
]
maintain = [
"black>=23.1",
Expand Down
Loading
Loading