future-oxygen-10553
08/30/2022, 6:42 PMYYYY.M.D
) to version my packages, instead of semver. Additionally, if this is not a release build, I would like to add the most recent git commit hash to the version, so something like 2022.8.30+gabcd123
. I see that there’s a vcs_version
target, which uses setuptools_scm
to pull the most recent git tag, but that doesn’t quite fit what I want to do. Is there any existing code out there to solve this? If not, I started going about this as a plugin, but I’m stuck because I don’t see how the vcs_version
target knows that it needs to call setuptools_scm
. I suppose the relationship is that the generate_python_from_setuptools_scm
rule depends on a GenerateSourcesRequest
which has the VCSVersionDummySourceField
as its input, and the vcs_version
target has VCSVersionDummySourceField
as one of its required fields. What I’m not clear about is whether I should create a new field specifically for my own VCS-ish version, or if I can reuse the existing fields inside pants?git
so that it still has access to the worktree to be able to read the commit hashProcess
and I’ve copied the maybe_git_worktree
from the setuptools_scm
-related code, but I don’t understand how to pass the worktree to the Process
VCSVersionDummySourceField
results in an error because it’s ambiguous which implementation of the code generator to use. So that answers that question, I suppose!