https://pantsbuild.org/ logo
#general
Title
# general
b

bulky-alarm-94027

05/20/2022, 2:00 PM
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

curved-television-6568

05/20/2022, 2:16 PM
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

hundreds-father-404

05/20/2022, 2:19 PM
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

curved-television-6568

05/20/2022, 2:19 PM
(thanks Eric, I’ll have to read up on how that works)
❤️ 1
b

bulky-alarm-94027

05/20/2022, 2:21 PM
Thanks, i'll have a look at all three suggestions
c

curved-television-6568

05/20/2022, 2:28 PM
@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

hundreds-father-404

05/20/2022, 2:29 PM
I'm not certain, cc @happy-kitchen-89482
c

curved-television-6568

05/20/2022, 2:29 PM
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
4 Views