Skip to content

Commit 9682768

Browse files
committed
Update tagged-metadata documentation
1 parent 14a4920 commit 9682768

File tree

3 files changed

+30
-9
lines changed

3 files changed

+30
-9
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## Unreleased
2+
3+
* Added:
4+
* `tagged-metadata` option and corresponding `format` variable,
5+
as well as a `format` variable for the Dunamai `Version` instance.
6+
([Contributed by mariusvniekerk](https://github.com/mtkennerly/poetry-dynamic-versioning/pull/32))
7+
18
## v0.11.0 (2020-11-21)
29

310
* Added:

README.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,28 @@ In your pyproject.toml file, you may configure the following options:
6767
* `metadata`: Boolean. Default: unset. If true, include the commit hash in
6868
the version, and also include a dirty flag if `dirty` is true. If unset,
6969
metadata will only be included if you are on a commit without a version tag.
70-
* `tagged_metadata`: Boolean. Default: false. If true, include the tagged metadata
71-
discovered as the first of the metadata segments. Requires metatadata to be
72-
true as well to have effect.
70+
* `tagged-metadata`: Boolean. Default: false. If true, include any tagged
71+
metadata discovered as the first part of the metadata segment.
72+
Has no effect when `metadata` is set to false.
7373
* `dirty`: Boolean. Default: false. If true, include a dirty flag in the
7474
metadata, indicating whether there are any uncommitted changes.
75+
Has no effect when `metadata` is set to false.
7576
* `pattern`: String. This is a regular expression which will be used to find
76-
a tag representing a version. There must be a named capture group `base`
77-
with the main part of the version, and optionally you can also have groups
78-
named `stage` and `revision` for prereleases. The default is
79-
`^v(?P<base>\d+\.\d+\.\d+)(-?((?P<stage>[a-zA-Z]+)\.?(?P<revision>\d+)?))?$`.
77+
a tag representing a version. There must be a capture group named `base`
78+
with the main part of the version. Optionally, it may contain another two
79+
groups named `stage` and `revision` for prereleases, and it may contain a
80+
group named `tagged_metadata` to be used with the `tagged-metadata` option.
81+
82+
The default is:
83+
84+
```re
85+
(?x) (?# ignore whitespace)
86+
^v(?P<base>\d+\.\d+\.\d+) (?# e.g., v1.2.3)
87+
(-?((?P<stage>[a-zA-Z]+)\.?(?P<revision>\d+)?))? (?# e.g., beta-0)
88+
(\+(?P<tagged_metadata>.+))?$ (?# e.g., +linux)
89+
```
90+
91+
Remember that the backslashes must be escaped (`\\`) in the TOML file.
8092
* `format`: String. Default: unset. This defines a custom output format for
8193
the version. Available substitutions:
8294

@@ -180,6 +192,8 @@ In your pyproject.toml file, you may configure the following options:
180192
text to preserve before and after the replaced text. Default:
181193
`["(^__version__\s*=\s*['\"])[^'\"]*(['\"])"]`.
182194

195+
Remember that the backslashes must be escaped (`\\`) in the TOML file.
196+
183197
Simple example:
184198

185199
```toml

poetry_dynamic_versioning/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def _default_config() -> Mapping:
100100
"format-jinja": None,
101101
"format-jinja-imports": [],
102102
"bump": False,
103-
"tagged_metadata": False,
103+
"tagged-metadata": False,
104104
}
105105
}
106106
}
@@ -196,7 +196,7 @@ def _get_version(config: Mapping) -> Tuple[Version, str]:
196196
format=config["format"],
197197
style=style,
198198
bump=config["bump"],
199-
tagged_metadata=config["tagged_metadata"],
199+
tagged_metadata=config["tagged-metadata"],
200200
)
201201

202202
return (version, serialized)

0 commit comments

Comments
 (0)