Skip to content

Commit d8bcc76

Browse files
committed
docs: explain about style
1 parent 2c35af2 commit d8bcc76

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

docs/version_source.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ You may configure the following options under `[tool.uv-dynamic-versioning]`:
149149
```
150150
151151
- `style` (string, default: unset): One of: `pep440`, `semver`, `pvp`. These are pre-configured output formats. If you set both a `style` and a `format`, then the format will be validated against the style's rules. If `style` is unset, the default output format will follow PEP 440, but a custom `format` will only be validated if `style` is set explicitly.
152+
Regardless of the style you choose, the dynamic version is ultimately subject to Hatchling's validation as well, and Hatchling is designed around PEP 440 versions. Hatchling can usually understand SemVer/etc input, but sometimes, Hatchling may reject an otherwise valid version format.
152153
- `latest-tag` (boolean, default: false): If true, then only check the latest tag for a version, rather than looking through all the tags until a suitable one is found to match the `pattern`.
153154
- `bump` (boolean or table, default: false): If enabled, then increment the last part of the version `base` by 1, unless the `stage` is set, in which case increment the `revision` by 1 or set it to a default of 2 if there was no `revision`. Does nothing when on a commit with a version tag. One of:
154155
@@ -187,12 +188,33 @@ You may configure the following options under `[tool.uv-dynamic-versioning]`:
187188
If set, use this regular expression to extract the version from the file.
188189
The first capture group must contain the version.
189190
190-
Simple example:
191+
### Examples
192+
193+
Default (no `tool.uv-dynamic-versioning` in `pyproject.toml`):
194+
195+
```bash
196+
$ git tag v1.0.0
197+
$ uv build
198+
Building source distribution...
199+
Building wheel from source distribution...
200+
Successfully built dist/foo-1.0.0.tar.gz
201+
Successfully built dist/foo-1.0.0-py3-none-any.whl
202+
```
203+
204+
With `pattern`:
191205
192206
```toml
193207
[tool.uv-dynamic-versioning]
194-
vcs = "git"
195-
style = "semver"
208+
pattern = "default-unprefixed"
209+
```
210+
211+
```bash
212+
$ git tag 1.0.0
213+
$ uv build
214+
Building source distribution...
215+
Building wheel from source distribution...
216+
Successfully built dist/foo-1.0.0.tar.gz
217+
Successfully built dist/foo-1.0.0-py3-none-any.whl
196218
```
197219
198220
## Environment Variables

0 commit comments

Comments
 (0)