Skip to content

Warning tag_filter is not a valid function reference appears if there is no matching tag? #93

@nicholas-russell

Description

@nicholas-russell

I am using this in a monorepo with the following structure:

<root>
app
 └─sub-folder
    └─my-pkg
       └─pyproject.toml

The configuration is

[build-system]
requires = ["setuptools>=61.0", "setuptools-git-versioning"]
build-backend = "setuptools.build_meta"

...

[tool.setuptools-git-versioning]
enabled = true
tag_filter = "my-pkg/(?P<tag>.*)"
tag_formatter = ".*/(?P<tag>.*)"
dev_template = "{tag}+{branch}.{sha}"
dirty_template = "{tag}+{branch}.{sha}.dirty"

Running the command below, without any tag:

~/app/sub-folder/my-pkg$ setuptools-git-versioning
[2024-01-24 15:37:18,569]  WARNING: tag_filter is not a valid function reference: Wrong reference name: my-pkg/(?P<tag>.*)
0.0.1

Now when I do tag something (e.g., my-pkg/1.0.0), it gives me something different

~/app/sub-folder/my-pkg$ setuptools-git-versioning
[2024-01-24 15:38:02,986]  WARNING: tag_filter is not a valid function reference: Wrong reference name: my-pkg/(?P<tag>.*)
[2024-01-24 15:38:03,009]  WARNING: tag_formatter is not a valid function reference: Wrong reference name: .*/(?P<tag>.*)
1.0.0+master.9ff32a07.dirty

If I tag my current commit and have a clean working tree I get below, which is expected, but error messages are confusing. These don't really matter though.

~/app/sub-folder/my-pkg$ git tag my-pkg/1.1.0
~/app/sub-folder/my-pkg$ setuptools-git-versioning
[2024-01-24 15:39:47,446]  WARNING: tag_filter is not a valid function reference: Wrong reference name: my-pkg/(?P<tag>.*)
[2024-01-24 15:39:47,474]  WARNING: tag_formatter is not a valid function reference: Wrong reference name: .*/(?P<tag>.*)
1.1.0

So the crux of the issue is that when there is no tag and a filter, it won't append the VCS info.

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