The <docs> aren’t very clear: I have a `python_sou...
# general
a
The docs aren’t very clear: I have a
python_sources
that groups stuff, like
pex_binaries
and
files
, if I put that in the
dependencies
for a
docker_image
, will they be copied in? Just trying it out seems to suggest, no… How can we group things that we want to put in multiple
docker_image
s then?
r
As it says in the docs, currently
docker_image
only can depend on certain targets like
file
,
python_distribution
and
pex_binary
. So if you want to copy some
python_sources
directly, that won’t work.
h
This is something that @bitter-ability-32190 has a plan for improving
b
It's gonna be quite the journey 😅
1
👍 1
a
The docs don’t actually say that. In the actual docs it says “Addresses to other targets that this target depends on, e.g. [‘helloworld/subdir:lib’, ‘helloworld/main.py:lib’, ‘3rdparty:reqs#django’].” and in the link I posted, it says “A
docker_image
can depend on loose files belonging to `file` / `files` targets, and on artifacts packaged from a variety of targets, such as
pex_binary
,
python_distribution
,
archive
, or any other target that can be built via the package goal.”
But, yeah. So I guess duplicating that in every docker_image is the only workaround?
r
That doc is a generic doc and hence you get this kind of confusion. I created an issue and did some work to fix it but yeah not done yet https://github.com/pantsbuild/pants/issues/16522 EDIT: fixed the issue link
h
To clarify one thing about the question though: you mention “python_sources that groups stuff, like pex_binaries and files”, what do you mean by “groups” there? Does the
python_sources
depend on the
pex_binary
targets somehow?
a
Sadly, yes.
It used to, I just copy pasted it now 🙂
r
Another clarification after reading this issue https://github.com/pantsbuild/pants/issues/16561
currently inference is only for packagable targets
So even
files
won’t work
b
files
work as dependencies, but aren't inferred
a
Yeah, I was about to say, files work just fine if you specify it in the deps. We’re not using inference anywhere, there’s at least that 🙂
h
Ah, so we should do a better job (via tutorials and so on) of articulating what target types and their dependencies mean, but I’m not sure what “`python_sources` depending on a `pex_binary`” means, or will do
a
I can tell you with our old docker image plugin, it used to work 🙂 now, I have no idea. What’s a way of just saying “this is a group of things”?
c
you can use a plain
target
to just group stuff together and depend on that single address.
a
That is exactly what I was looking for, I was looking for something like group or similar. Thank you!
👍 1