Brainstorm invitation: I want to add support for `...
# development
h
Brainstorm invitation: I want to add support for
setuptools_scm
(https://github.com/pypa/setuptools_scm) which is a utility that uses various heuristics to grab a version number out of git (it looks at latest tag+changes since the most recent tag). It is typically invoked in setup.py. It typically writes the version to a gitignored source file (e.g.,
_version.py
) in the source tree. Its configuration, including the destination file, lives in pyproject.toml. I'm trying to figure out how best to implement this in Pants. It's sort-of codegen, but note that there is no original source file, equivalent to a .proto, in this case. In fact, we have to run this codegen every time, and cannot cache it, because git state may have changed from under us.
So questions include:
1) Do we materialize that source file into the repo, which is what existing users might expect? Or do we treat it like codegen?
2) Do we just run this on every single Pants run? Is there a way to do so? Or do we attempt to do it only when the resulting source file would be needed? And if so, how would we do that, given that there is no originating target?
Trying to figure out how to model this
Thoughts welcome!
h
it's sort-of codegen, but note that there is no original source file,
docker_image(instructions=)
is codegen w.o input file. Same w/
archive
In fact, we have to run this codegen every time, and cannot cache it, because git state may have changed from under us.
that's totally fine. mark the codegen request not cacheable
to a gitignored source file
that's a good hint for #1
w
The newly exposed git rule is already not cacheable, so if your codegen depends on it, you're good to go.
1
h
docker_image()
is still something you act on explicitly. What would trigger a rule in this case?
w
another target type… perhaps called
setuptools_scm
h