Skip to content

Default version for regex source #1980

@Furetur

Description

@Furetur

Proposal

Please consider adding a new TOML option to the regex version source named default.

[tool.hatch.version]
source = “regex”
path = “version.txt”
default = “0.dev”

Semantics: If the default option is specified and the version file is not found, the default value will be used as the current version. If default is not specified, the version source will continue with its previous behaviour.

Validity Rules: The default value must adhere to the PEP 440 version format.

Intended use case

At our workplace, we use an internal tool to calculate versions. It interacts with Hatch (UV) via regex source via version.txt. Currently, if version.txt is missing, uv build or uv sync crash. We’d like to build the project or synchronise dependencies locally without using the internal tool. Hence, it would be handy to be able to just set the default version.

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