Hello again, is there a Pants best practice for re...
# general
b
Hello again, is there a Pants best practice for releasing artifacts from a monorepo? Specifically, are all my subprojects that produce an artifact (e.g. a python wheel) going to have the same version? If this is the case, how do I parametrise/inject the version value into the
python_distribution
targets? This is kindof related to my previous question about getting the output of git describe
c
Hi 👋 The Pants build way of dynamically providing values for the setup call in
setup.py
is to write a plugin that implements
SetupKwargs
as described here: https://www.pantsbuild.org/docs/plugins-setup-py
Another (simpler) option is to write a macro, that creates your targets with the desired values. https://www.pantsbuild.org/docs/macros
Macros are more limited, but works well if they don’t need to reference external data, but can work with hardcoded values, or values you provide when invoking the macro.
h
or a new feature in 2.13 is to use Pants's new
setuptools_scm
integration: https://github.com/pantsbuild/pants/pull/15374
👀 1
c
(thanks Eric, I’ll have to read up on how that works)
❤️ 1
b
Thanks, i'll have a look at all three suggestions
c
@hundreds-father-404 the
setuptools_scm
integration doesn’t integrate with the
python_distribution
target, right? I mean, it doesn’t setup the distribution version for you, from what I can tell, only a python source file with some content, such as a
version = "x.y.z"
line in a
_version.py
or some such.
h
I'm not certain, cc @happy-kitchen-89482
c
or have I missed somthing…
Oh, reading the setuptools scm docs, seems like there’s a bunch of new options that it offers that could help with that. Maybe we just need to tie the ends together here.. ?
👍 1