Poetry complains about no git tag during export or lock
sl304227-nh opened this issue · comments
Would it be possible to bypass this git tag check except and only during a build? We only need it during a build right.
During Dockerfile builds or any other shell commands, it complains about not having a tag for basic poetry commands. It should only complain during a poetry build
.
poetry-version-plugin: No Git tag found, not extracting dynamic version
at /usr/local/lib/python3.8/site-packages/poetry_version_plugin/plugin.py:106 in activate
102│ "poetry-version-plugin: No Git tag found, not "
103│ "extracting dynamic version"
104│ )
105│ io.write_error_line(message)
→ 106│ raise RuntimeError(message)
107│
It appears we could make a boolean in the pyproject.toml file that could help us:
[tool.poetry-version-plugin]
source = "git-tag"
git-tag-check = false
Then in the plugin.py, after checking for exit code, if we get a non-zero, we could simply warning.warn() the message, rather than raise an exception. We could raise the exception if git-tag-check = true
of course.
What do you think?
I think the most elegant is definitely to only check on poetry build
commands, and not on any other command.
I've just discovered this package (which is awesome on the surface) but this issue is proving a dealbreaker for me
System:
- macOS 14.2.1
- Python 3.10.13
- Poetry 1.7.1
Has anybody found a decent workaround, or should I try another package, like https://pypi.org/project/poetry-dynamic-versioning/?