@@ -253,6 +253,100 @@ For Git projects, the version relies on [git describe](https://git-scm.com/docs
253
253
so you will see an additional ` g ` prepended to the ` {revision hash} ` .
254
254
255
255
256
+ ## Version Tag Formats
257
+
258
+ setuptools-scm automatically detects version information from SCM tags. The default tag regex
259
+ supports a wide variety of tag formats, with the ** "v" prefix being recommended** for clarity
260
+ and consistency.
261
+
262
+ ### Recommended Tag Format
263
+
264
+ ** Use the "v" prefix for version tags:**
265
+
266
+ ``` bash
267
+ git tag v1.0.0 # Recommended
268
+ git tag v2.1.3
269
+ git tag v1.0.0-alpha1
270
+ git tag v1.0.0-rc1
271
+ ```
272
+
273
+ ### Supported Tag Formats
274
+
275
+ setuptools-scm's default tag regex supports:
276
+
277
+ - ** Version prefix** : ` v ` or ` V ` (optional, but recommended)
278
+ - ** Project prefix** : Optional project name followed by dashes (e.g., ` myproject-v1.0.0 ` )
279
+ - ** Version number** : Standard semantic versioning patterns
280
+ - ** Pre-release suffixes** : Alpha, beta, RC versions
281
+ - ** Build metadata** : Anything after ` + ` is ignored
282
+
283
+ ** Examples of valid tags:**
284
+ ``` bash
285
+ # Recommended formats (with v prefix)
286
+ v1.0.0
287
+ v2.1.3
288
+ v1.0.0-alpha1
289
+ v1.0.0-beta2
290
+ v1.0.0-rc1
291
+ v1.2.3-dev
292
+ V1.0.0 # Capital V also works
293
+
294
+ # Project-prefixed formats
295
+ myproject-v1.0.0
296
+ my-lib-v2.1.0
297
+
298
+ # Without v prefix (supported but not recommended)
299
+ 1.0.0
300
+ 2.1.3
301
+ 1.0.0-alpha1
302
+
303
+ # With build metadata (metadata after + is ignored)
304
+ v1.0.0+build.123
305
+ v1.0.0+20240115
306
+ ```
307
+
308
+ ### Why Use the "v" Prefix?
309
+
310
+ 1 . ** Clarity** : Makes it immediately obvious that the tag represents a version
311
+ 2 . ** Convention** : Widely adopted standard across the software industry
312
+ 3 . ** Git compatibility** : Works well with git's tag sorting and filtering
313
+ 4 . ** Tool compatibility** : Many other tools expect version tags to have a "v" prefix
314
+
315
+ ### Custom Tag Patterns
316
+
317
+ If you need different tag patterns, you can customize the tag regex:
318
+
319
+ ``` toml title="pyproject.toml"
320
+ [tool .setuptools_scm ]
321
+ tag_regex = " ^release-(?P<version>[0-9]+\\ .[0-9]+\\ .[0-9]+)$"
322
+ ```
323
+
324
+ ## Node ID Prefixes
325
+
326
+ setuptools-scm automatically prepends identifying characters to node IDs (commit/revision hashes)
327
+ to distinguish between different SCM systems:
328
+
329
+ - ** Git repositories** : Node IDs are prefixed with ` g ` (e.g., ` g1a2b3c4d5 ` )
330
+ - ** Mercurial repositories** : Node IDs are prefixed with ` h ` (e.g., ` h1a2b3c4d5 ` )
331
+
332
+ This prefixing serves several purposes:
333
+
334
+ 1 . ** SCM identification** : Makes it clear which version control system was used
335
+ 2 . ** Consistency** : Ensures predictable node ID format across different SCM backends
336
+ 3 . ** Debugging** : Helps identify the source SCM when troubleshooting version issues
337
+
338
+ The prefixes are automatically added by setuptools-scm and should be included when manually
339
+ specifying node IDs in environment variables like ` SETUPTOOLS_SCM_PRETEND_METADATA ` .
340
+
341
+ ** Examples:**
342
+ ``` bash
343
+ # Git node ID
344
+ 1.0.0.dev5+g1a2b3c4d5
345
+
346
+ # Mercurial node ID
347
+ 1.0.0.dev5+h1a2b3c4d5
348
+ ```
349
+
256
350
!!! note
257
351
258
352
According to [PEP 440](https://peps.python.org/pep-0440/#local-version-identifiers>),
0 commit comments