fresh-cat-90827
02/03/2023, 5:03 PMfresh-cat-90827
02/03/2023, 5:03 PM# in the parent directory
__defaults__(extend=True, all=dict(tags=["global-tag"]))
# in the child directory
python_sources(
name="lib",
tags=["local-tag"],
)
when doing ./pants peek
, I can see that python_sources
only has ["local-tag"]
, not ["global-tag", "local-tag"]
one may want. I am aware of the options syntax --scope-listopt="+[3,4]"
, but you can't use this on targets, can you?
Is there a way to extend fields preserving whatever the default has been assigned by the parent(s)?curved-television-6568
02/03/2023, 6:10 PM__defaults__
there is no merging going on, but you may preserve rather than replace defaults, using the extend=True
keyword. See near the end of this section: https://www.pantsbuild.org/docs/targets#field-default-values
Using only targets, you can use
python_sources(sources=["custom.py", *python_sources.sources.default
From: https://github.com/pantsbuild/pants/pull/17649
N.b. Weโve not yet updated the docs with that last one.. ๐ฌ
In summary, Iโve not yet come up with a solution for what you want here.. ๐curved-television-6568
02/03/2023, 6:12 PMpython_sources.tags.default
reflected the current state of __defaults__
too..curved-television-6568
02/03/2023, 6:12 PMfresh-cat-90827
02/03/2023, 6:20 PMcurved-television-6568
02/04/2023, 2:40 PM