Skip to content

Support a default value for dynamic version source "env"` #1853

Open
@abrahammurciano

Description

@abrahammurciano

Right now, hatch has an environment version source, which can be used to specify an environment variable to take the version from. e.g:

[tool.hatch.version]
source = "env"
variable = "MY_VERSION"

This is ideal for setting the version from an external source (e.g. in CICD), but this also means that if the environment variable is not set, some commands (e.g. pip install -e . will fail because the version was not set.

It would be great to have an optional default option to specify the version to use if none is set. e.g.

[tool.hatch.version]
source = "env"
variable = "MY_VERSION"
default = "0+dev"

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