Skip to content

UserWarning: tag '0.0' no version found in a fresh Git repo when tag_regex is defined #804

@TheTaylorHicks

Description

@TheTaylorHicks

Trying to use setuptools_scm==7.1.0 on a brand new repository with no tags fails if tag_regex has been specified that does not match the default fallback version 0.0, like the example below:

^(?P<prefix>packagename[-_])(?P<version>[vV]?\d+(?:\.\d+){0,2}[^\+]*)(?:\+.*)?$

After a little troubleshooting and inspecting the source code, the problem seems to be that if no tags are found in the parent git repo matching the provided regex, setuptools_scm.git._git_parse_inner attempts to fake a tag 0.0 to provide to setuptools_scm.version.meta as a default.

This later causes a panic when setuptools_scm.version.tag_to_version attempts to match 0.0 against the configured regular expression and returns None.

For context, I'm trying to introduce setuptools_scm to a pre-existing monorepo containing multiple Python projects that need to be individually versioned. As such, I can't use an optional prefix as tags without a prefix would have a chance to override the version of every package in the repository.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions