It might be similar to what <@U065GR6HS4W> is tryi...
# plugins
h
It might be similar to what @adventurous-rain-63973 is trying to achieve. We've got a large number of resolves, and each internal package must declare
resolve
and
interpreter_constraints
of each of its users like so:
Copy code
python_sources(
  **parametrize('app_1', interpreter_constraints=['==3.7.*'], resolve='app_1'),
  **parametrize('app_2', interpreter_constraints=['==3.8.*'], resolve='app_2'),
)
poetry_requirements(
  resolve=parametrize('app_1', 'app_2')
)
I'm thinking of a programmatic way of injecting those parameters automatically like synthetic targets Is there any way to possibly achieve that?
f
You can use the
__defaults__
mechanism to set default field values for targets. https://www.pantsbuild.org/stable/docs/using-pants/key-concepts/targets-and-build-files#field-default-values
You could alternatively define a macro (e.g.,
my_python_sources
) which also injects the parameters (but then all relevant
BUILD
files would need to be updated to use
my_python_sources
instead of
python_sources
). https://www.pantsbuild.org/stable/docs/writing-plugins/macros
h
I'm thinking about some sort of a mechanism that'd allow me to: 1. Catch all targets that depend on the package 2. Extract their
resolve
and
interpreter_constraints
3. Update the package target with this information as previously explained Correct me if I'm wrong but both
__defaults__
& macros are hard-coded...