Skip to content

Version epoch support #122

@Henri-J-Norden

Description

@Henri-J-Norden

Description

According to Versioning - Python Packaging User Guide, version identifiers may be prefixed by an optional epoch segment N! (where N may be any non-negative integer).

However, the "!" is incorrectly converted to a "." when an epoch segment is added to a template in tool.setuptools-git-versioning.

Example

pyproject.toml

[tool.setuptools-git-versioning]
dirty_template = "0!{timestamp:%Y.%m.%d}+{sha}.dirty"

Generated version

$ uvx setuptools-git-versioning -v
...
[2025-12-03 23:04:02,207]     INF0: Using template from 'dirty_template' option
[2025-12-03 23:04:02,208]     INF0: Version number after resolving substitutions: '0!2025.12.03+fc88762e.dirty'
[2025-12-03 23:04:02,208]     INF0: Before sanitization '0!2025.12.03+fc88762e.dirty'
[2025-12-03 23:04:02,208]     INF0: Result '0.2025.12.3+fc88762e.dirty'
0.2025.12.3+fc88762e.dirty

Expected result

0!2025.12.3+fc88762e.dirty

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions